I have a dataframe x with this values:
x
x1 x2 x3 1 NA 4 1 2 NA 3 NA 3 4 NA 2 4 NA 1 11 5 NA 2 NA 6 5 NA 1 7 5 9
you could write a column maximum function, colMax.
colMax
colMax <- function(data) sapply(data, max, na.rm = TRUE)
Use colMax function on sample data:
colMax(x) # x1 x2 x3 # 5.0 9.0 11.0