min for each row in a data frame

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.

To remove missing values, use:

apply(df, 1, FUN = min, na.rm = TRUE)

Leave a Comment