Friday, 16 August 2013

How to find min value of each col in df and delete previous values?

How to find min value of each col in df and delete previous values?

Assuming I have the following data frame:
x1 <- c(12:4, 5:8, NA, NA)
x2 <- c(15:8, 9:15)
x3 <- c(14:9, 10:13, NA, NA, NA, NA, NA)
df <- data.frame(cbind(x1, x2, x3))
How can I search for the minimum value in each column, delete all values
before and fill the columns with NAs to preserve equal length? My real dfs
have varying numbers of cols and rows.

No comments:

Post a Comment