drop_row_if: Conditionally drop rows based on percent missingness

Description Usage Arguments Examples

View source: R/drop_row_if.R

Description

Conditionally drop rows based on percent missingness

Usage

1
drop_row_if(df, sign = "gt", type = "count", value = 20, as_percent = TRUE)

Arguments

df

A data.frame object

sign

Character. One of gteq,lteq,lt,gt or eq which refer to greater than(gt) or equal(eq) or less than(lt) or equal to(eq) respectively.

type

One of either count or percent. Defaults to count

value

Value to use for the drop.

as_percent

Logical. If set to TRUE, percent_na is treated as a percentage. Otherwise, decimals(fractions) are used.

Examples

1
2
3
4
5
6
7
head(drop_row_if(airquality,sign = "gteq",
type = "percent",value=16, as_percent = TRUE))
# should give the same output as above.
head(drop_row_if(airquality, sign="gteq", type="percent",value = 0.15, as_percent=FALSE))
# Drop based on NA counts
df <- data.frame(A=1:5, B=c(1,NA,NA,2, 3), C= c(1,NA,NA,2,3))
drop_row_if(df, type="count",value=2,sign="eq")

mde documentation built on Feb. 10, 2022, 5:08 p.m.

Related to drop_row_if in mde...