View source: R/dropRowsWithAllNA.R
dropRowsWithAllNA | R Documentation |
Drop rows with all missing (NA
) values.
dropRowsWithAllNA(data, ignore = NULL)
data |
Dataframe to drop rows from. |
ignore |
Names of columns to ignore for determining whether each row had all missing values. |
Drop rows that have no observed values, i.e., all values in the row are
missing (NA
), excluding the ignored columns.
A dataframe with rows removed that had all missing values in non-ignored columns.
Other dataManipulation:
columnBindFill()
,
convert.magic()
,
dropColsWithAllNA()
,
varsDifferentTypes()
Other dataEvaluations:
dropColsWithAllNA()
,
is.nan.data.frame()
,
not_all_na()
,
not_any_na()
# Prepare Data
df <- expand.grid(ID = 1:100, time = c(1, 2, 3))
df <- df[order(df$ID),]
row.names(df) <- NULL
df$score1 <- rnorm(nrow(df))
df$score2 <- rnorm(nrow(df))
df$score3 <- rnorm(nrow(df))
df[sample(1:nrow(df), size = 100), c("score1","score2","score3")] <- NA
# Drop Rows with All NA in Non-Ignored Columns
dropRowsWithAllNA(df, ignore = c("ID","time"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.