Skip to contents

Generate a summary table from the WCVP

Usage

wcvp_summary(
  taxon = NULL,
  taxon_rank = c("species", "genus", "family", "order", "higher"),
  area_codes = NULL,
  grouping_var = c("area_code_l3", "genus", "family", "order", "higher"),
  hybrids = FALSE,
  wcvp_names = NULL,
  wcvp_distributions = NULL
)

Arguments

taxon

Character. Taxon to be included. Defaults to NULL (no taxonomic filter; all taxa).

taxon_rank

Character. One of "genus", "family", "order" or "higher", giving the rank of the value/s in taxon. Must be specified unless taxon is NULL.

area_codes

Character. One or many WGSPRD level 3 region codes. Defaults to NULL (global).

grouping_var

Character; one of "area_code_l3", "genus", "family","order" or "higher" specifying how the summary should be arranged. Defaults to area_code_l3.

hybrids

Logical. Include hybrid species in counts? Defaults to FALSE.

wcvp_names

A data frame of taxonomic names from WCVP version 7 or later. If NULL, names will be loaded from rWCVPdata::wcvp_names.

wcvp_distributions

A data frame of distributions from WCVP version 7 or later. If NULL, distributions will be loaded from rWCVPdata::wcvp_names.

Value

Data.frame with filtered data, or a gt table

Details

Valid values for rank 'higher' are 'Angiosperms', 'Gymnosperms', 'Ferns' and 'Lycophytes'. Note that grouping variable (if taxonomic) should be of a lower level than taxon and taxon_rank to produce a meaningful summary (i.e., it does not make sense to group a genus by genus, family or higher classification). Additionally, if the grouping variable is taxonomic then species occurrences are aggregated across the input area. This means that if a species is native to any of the input area (even if it is introduced or extinct in other parts) it is counted as 'Native'. Similarly, introduced occurrences take precedence over extinct occurrences. Note that in this type of summary table, 'Endemic' means endemic to the input area, not necessarily to a single WGSRPD Level 3 Area within the input area.

Examples

 # this example requires 'rWCVPdata'
if(requireNamespace("rWCVPdata")){
ferns <- wcvp_summary("Ferns", "higher", get_wgsrpd3_codes("New Zealand"), grouping_var = "family")
wcvp_summary_gt(ferns)
}
#>  Matches to input geography found at Country (Gallagher) and Region (Level 2)
#>  Aggregating occurrence types across input area ("New Zealand") - see `?wcvp_summary()` for details.
Ferns of New Zealand
Total number of species: 209
Number of regionally endemic species: 78
Family Native Endemic Introduced Extinct Total
Aspleniaceae 56 22 2 58
Cyatheaceae 11 8 1 12
Dennstaedtiaceae 12 2 12
Gleicheniaceae 9 1 9
Hymenophyllaceae 28 17 28
Lindsaeaceae 3 1 3
Marattiaceae 1 1
Marsileaceae 1 1
Ophioglossaceae 6 1 6
Osmundaceae 3 2 1 4
Polypodiaceae 35 16 8 43
Psilotaceae 6 1 6
Pteridaceae 18 6 1 19
Salviniaceae 1 1 2
Schizaeaceae 5 1 5