
Compute site trait coverage for each trait combination
Source:R/fb_get_trait_combination_coverage.R
fb_get_trait_combination_coverage.RdThis function computes trait coverage for each site for different trait The function will not run if the total number of combinations given is over 10,000.
Arguments
- site_species
a
data.framewith sites in rows and species in columns. NOTE: the first column should be named"site"and indicate site names. The other columns should be named according to species names.- species_traits
a
data.framewith species in rows and traits as columns. NOTE: The first column should be named"species"and contain species names. The other columns should be named according to trait names.- comb_size
an integer vector defining one or more sizes of combinations over which to compute trait coverage. (default:
NULL)
Value
a data.frame with the following columns:
sitewith the site indices fromsite_species,combination_lengthwith the number of traits in given combinations,combination_namewith the name of the trait combination (concatenated trait names with__),trait_coveragethe corresponding trait coverage for the given trait combination and site.
Examples
# Compute Coverages using All Trait Combinations
all_combinations <- fb_get_trait_combination_coverage(
woodiv_site_species, woodiv_traits
)
# Get only combinations of 3 traits
three_traits <- fb_get_trait_combination_coverage(
woodiv_site_species, woodiv_traits, 3
)
# Combinations of 2, 3, and 4 traits
two_to_four <- fb_get_trait_combination_coverage(
woodiv_site_species, woodiv_traits, 2:4
)