Home > Back-end >  how to use which.min() function in a dataframe
how to use which.min() function in a dataframe

Time:09-13

I have a dataset with columns and rows and in that dataset I want to extract the minimum water potential value which i did by using the which.min() function which gave me the position of the element present in the data frame but other than that I want the species and the day for that value recorded which codes to use?

CodePudding user response:

if I understand it correctly you have a data frame, say df, and which.min(df$water_potential) returns you the position of the observation with the minimum value. What happens if you try something like

df[which.min(df$water_potential),]

to retrieve the other column values for this observation?

  • Related