R/summary.R
diet_summary.Rd
Given a diet data.frame, the prey or predators are aggregated to group level and dietary importance values reported. Note that dietary importance values are currently calculated by unweighted averaging across studies (so that e.g. a study of 100 individuals will carry the same weight as a study of one individual).
diet_summary( x, summary_type = "prey", minimum_importance = 0, treat_trace_values_as = 0 )
x | data.frame: diet data, as returned by |
---|---|
summary_type | string: either "predators" (report the predators in the data) or "prey" (report the prey items) |
minimum_importance | numeric: ignore records with dietary importance less than this threshold |
treat_trace_values_as | numeric: what numeric value to use for a dietary item recorded as "trace" |
data.frame with columns:
N_fraction_diet_by_weight - number of diet observations where fraction of diet by weight was quantified
fraction_diet_by_weight - mean fraction of diet by weight
N_fraction_occurrence - number of diet observations where fraction of occurrence quantified
fraction_occurrence - mean fraction of occurrence
N_fraction_diet_by_prey_items - number of diet observations where fraction of diet by number of prey items was quantified
fraction_diet_by_prey_items - mean fraction of diet by number of prey items
if (FALSE) { x <- so_diet() ## summary of what Electrona carlsbergi eats x %>% filter_by_predator_name("Electrona carlsbergi") %>% diet_summary(summary_type = "prey") ## summary of what eats Electrona carlsbergi x %>% filter_by_prey_name("Electrona carlsbergi") %>% diet_summary(summary_type = "predators") }