Skip to contents

Selects sites (rows) for which the percentage of present species (distribution value higher than 0 and non-NA) is higher than a threshold.

Usage

fb_filter_sites_by_species_coverage(
  site_species,
  threshold_species_proportion = 0
)

Arguments

site_species

a data.frame with 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.

threshold_species_proportion

a numeric of length 1 between 0 and 1. The percentage of species coverage threshold.

Value

A subset of site_species with sites covered by X% of species.

Examples

library("funbiogeo")

data("site_species")

# Get sites with more than 40% of the species
new_site_species <- fb_filter_sites_by_species_coverage(
  site_species,
  threshold_species_proportion = 0.4
)
# There are now only 148 sites
dim(new_site_species)
#> [1] 148 150
new_site_species[1:3, 1:4]
#>     site sp_001 sp_002 sp_003
#> 673  673      0      1      0
#> 674  674      0      1      0
#> 675  675      0      1      0