drop_row_if {mde} | R Documentation |
Conditionally drop rows based on percent missingness
Description
Conditionally drop rows based on percent missingness
Usage
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
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")
[Package mde version 0.3.2 Index]