which.min to obtain minimum from column Amount

MAP   TC       truck_id   Day VARIANCE shift2 TRASH_AMOUNT Amount Tiempo
  <fct> <fct>    <fct>    <dbl> <fct>    <fct>  <fct>         <dbl>  <dbl>
1 2     COMPACTT truck 12    50 LOW      1      HIGH           550.   73.1
2 2     COMPACTT truck 12    51 LOW      1      HIGH          1798.   88.4
3 2     COMPACTT truck 12    51 LOW      2      HIGH           221.   40.4
4 2     COMPACTT truck 12    52 LOW      1      HIGH           863.   66.8
5 2     COMPACTT truck 12    52 LOW      2      HIGH           138.   44.9
6 2     COMPACTT truck 12    53 LOW      1      HIGH           707.   59.1
7 2     COMPACTT truck 12    53 LOW      2      HIGH           496    36.9
8 2     COMPACTT truck 12    54 LOW      1      HIGH          1257.   97.7
9 2     COMPACTT truck 12    54 LOW      2      HIGH           203    45.2
10 2     COMPACTT truck 12    55 LOW      1      HIGH           816.   86.1

I have this data above and I am trying to obtain the minimum value on the colum Amount however I am doing this

Tabla7<- filter(data7, thrash_left_in_block >0 & VARIANCE=="LOW" & TRASH_AMOUNT=="HIGH"  &  Day >=50  ) # Turno 1
View(Tabla7)
colnames(Tabla7)


Grafico7 <- Tabla7 %>%                                  
  group_by(MAP,TC,truck_id,Day,VARIANCE,shift2,TRASH_AMOUNT) %>%                       
  summarise(Amount= sum(thrash_left_in_block),
            Tiempo = sum(time_spend_to_move+time_spend_to_collect),
            ) 

View(Grafico7)
Grafico7$Amount[which.min(Grafico7$Amount)]

I would like to have the complete row where is located the minimum but it is only giving me this
Grafico7$Amount[which.min(Grafico7$Amount)]
[1] 3.25

Try


Grafico7[which.min(Grafico7$Amount), ]
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.