dropWhen: Remove columns with specific trash

Description Usage Arguments Value Author(s) Examples

View source: R/dropWhen.R

Description

Remove columns with specific trash

Usage

1
2
dropWhen(df, unique = FALSE, trash = NULL, requireAll = TRUE,
  except = NULL)

Arguments

df

Data frame to column filter

unique

Boolean for whether to return only unique rows after column filtering

trash

Character vector containing all the trash values, besides NA, for which a column can be removed

requireAll

Boolean as to whether you want to require all rows in a column to equal a value in trash before filtering the column out (TRUE).

except

Character vector containing all column names to ignore when dropping columns (these will be retained regardless of the other parameter choices).

Value

Returns a columnn filtered data frame. Note, does not take into account numeric, integer or character value differences (it will treat them all the same).

Author(s)

Amy Paguirigan

Examples

1
2
3
df <- data.frame(this = c(NA, seq(1, 5, 1), seq(1, 5, 1)), that = rep(0, 11),
thisotherThing = rep(NA), ohAndThis = rep(c("trash", "0"), 11))
cleanerdf <- dropWhen(df, unique = FALSE, trash = c("0", "trash"), requireAll = FALSE)

FredHutch/freddie documentation built on Nov. 20, 2019, 6:31 a.m.