min for each row with dataframe in R

后端 未结 4 1424
伪装坚强ぢ
伪装坚强ぢ 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:52

    We could also use rowMins from library(matrixStats)

    library(matrixStats)
    df$minIwant <- rowMins(as.matrix(df))
    

提交回复
热议问题