Description Usage Arguments Source Examples
DropNA
drops rows from a data frame when they have missing (NA
)
values on a given variable(s).
1 |
data |
a data frame object. |
Var |
a character vector naming the variables you would like to have
only non-missing ( |
message |
logical. Whether or not to give you a message about the number of rows that are dropped. |
Partially based on Stack Overflow answer written by donshikin: http://stackoverflow.com/questions/4862178/remove-rows-with-nas-in-data-frame
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Create data frame
a <- c(1:4, NA)
b <- c(1, NA, 3:5)
ABData <- data.frame(a, b)
# Remove missing values from column a
ASubData <- DropNA(ABData, Var = "a", message = FALSE)
# Remove missing values in columns a and b
ABSubData <- DropNA(ABData, Var = c("a", "b"))
# Remove missing values in all columns of ABDatat
AllSubData <- DropNA(ABData)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.