replace_by_importance: Replace diet data entries below a given importance threshold

View source: R/utils.R

replace_by_importanceR Documentation

Replace diet data entries below a given importance threshold

Description

Replace diet data entries below a given importance threshold

Usage

replace_by_importance(x, threshold, replace_with = NA, which_measures = "all")

Arguments

x

data.frame: diet data, as returned by so_diet

threshold

numeric: replace entries below this threshold

replace_with

numeric: value to replace with

which_measures

string: one or more of "fraction_diet_by_weight", "fraction_diet_by_prey_items", "fraction_occurrence", or "all" (shorthand for all three)

Value

data.frame

See Also

so_diet filter_by_importance

Examples

## Not run: 
  x <- so_diet()
  ## discard entries representing less than 10% of diet
  x <- x %>% replace_by_importance(0.1)

## End(Not run)


SCAR/sohungry documentation built on Nov. 2, 2023, 4:19 p.m.