rm_NAs | R Documentation |
Remove all na cols, or rows
rm_NAs(df, margin = 0)
df |
your data |
margin |
1 means rm all NA rows, 2 means rm all NA cols, 0 means all rows and cols. |
new data
df <- 1:20 %>% matrix(nrow = 5) df[2, 4] <- NA df[5, 2] <- NA df[1, ] <- NA df[, 3] <- NA rownames(df) <- letters[1:5] colnames(df) <- letters[6:9] rm_NAs(df, margin = 1) rm_NAs(df, margin = 2) rm_NAs(df, margin = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.