Filter taxa recorded in less than x proportion of contexts

filter_prop(
  df,
  context = "cell",
  keep = NULL,
  default_prop = 0.05,
  min_prop = 0.01
)

Arguments

df

Dataframe with taxa and context

context

Character. Column names that define context.

keep

Character. taxa that should not be dropped. Can be used to decrease x lower than default_prop to ensure keep taxa appear in the filtered results. The lowest value of x required to keep any keep taxa then overrides default_prop for the whole dataset, but only up to min_prop.

default_prop

Numeric (proportion). If keep is NULL (or if no keep taxa occur within the df), filter any taxa recorded in less than default_prop proportion of contexts.

min_prop

Numeric (proportion). If keep is not null, do not lower x below min_prop.

Value

df filtered of taxa that occur in less than x% of contexts, taking into account default_prop, keep and/or min_prop.