min for each row with dataframe in R

后端 未结 4 1425
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 12:15

I\'m try to do a simple minimum across multiple columns in a data frame but the min function automatically returns the min across the whole of each column rather than for ea

4条回答
  •  情书的邮戳
    2020-11-29 12:35

    You can use apply to go through each row

    apply(df, 1, FUN=min)
    

    Where 1 means to apply FUN to each row of df, 2 would mean to apply FUN to columns.

提交回复
热议问题