Filter traits with a given species coverage threshold
Source:R/fb_filter_traits_by_species_coverage.R
fb_filter_traits_by_species_coverage.Rd
Selects traits (columns) for which the percentage of species without
NA
(missing trait values) is higher than a threshold.
Arguments
- species_traits
a
data.frame
with 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.- threshold_species_proportion
numeric(1)
[default =NULL
]
between 0 and 1. The percentage of species coverage threshold.
Examples
library("funbiogeo")
data("species_traits")
# Filter traits that have at least 60% non-missing values
new_species_traits <- fb_filter_traits_by_species_coverage(
species_traits,
threshold_species_proportion = 0.6
)
# There are now only 2 traits
ncol(new_species_traits)
#> [1] 3