How to extract the row with min or max values?

前端 未结 3 1712
南笙
南笙 2020-12-03 02:35

With a dataframe like this one:

        ID  Year    Temp    ph
1       P1  1996    11.3    6.80
2       P1  1996    9.7     6.90
3       P1  1997    9.8              


        
3条回答
  •  时光说笑
    2020-12-03 03:25

    You can include your which.max call as the first argument to your subsetting call:

    df[which.max(df$Temp),]
    

提交回复
热议问题