na: Remove all na cols, or rows

rm_NAsR Documentation

Remove all na cols, or rows

Description

Remove all na cols, or rows

Usage

rm_NAs(df, margin = 0)

Arguments

df

your data

margin

1 means rm all NA rows, 2 means rm all NA cols, 0 means all rows and cols.

Value

new data

Examples

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)

yanpd01/yyeasy documentation built on Dec. 1, 2022, 10:58 p.m.