removeNA | R Documentation |
this function will remove all NA entries from selected columns of a data frame
removeNA(df, cols)
df |
a data frame |
cols |
a vector of column names or column numbers |
A data frame
Tim Appelhans
df <- data.frame(a = 1:10, b = letters[1:10], c = rnorm(10, 2, 1))
df$a[sample(nrow(df), 3)] <- NA
df$b[sample(nrow(df), 2)] <- NA
df$c[sample(nrow(df), 1)] <- NA
df
removeNA(df, 1)
removeNA(df, 2)
removeNA(df, 3)
removeNA(df, c(1, 2))
removeNA(df, c(1, 2, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.