subsample: Subsampling data objects to certain species or sites

View source: R/Methods_for_data_objects.R

subsampleR Documentation

Subsampling data objects to certain species or sites

Description

Takes an object of type distrib_data or nodiv_data, and subsamples it to contain certain species or sites, while keeping the integrity of the data.

Usage

subsample(x, ...)
## S3 method for class 'distrib_data'
subsample(x, sites = NULL, species = NULL, ...)
## S3 method for class 'nodiv_data'
subsample(x, sites = NULL, species = NULL, node = NULL, ...)
## S3 method for class 'nodiv_result'
subsample(x, node = NULL, ...)

Arguments

x

An object of type distrib_data or nodiv_data

sites

A numeric or character vector identifying the sites to keep in the new object. If specified, the function will subsample the data object to only include the defined sites, and the species that exist there. If sites == \"all\", all sites will be kept when subsampling for species, even if no species now exist in the sites.

species

A numeric or character vector identifying the species to keep in the new object. If specified, the function will subsample the data object to only include the defined species, and the sites where they exist.

node

A numeric or character vector identifying a node in the phylogeny. Only species descending from this node will be kept in the new object, and the sites where they exist.

...

Further arguments to the subsample function

Value

The return value is a new object of the same type as x

Author(s)

Michael Krabbe Borregaard

See Also

distrib_data, ~~~

Examples

data(coquettes)
new <- subsample(coquettes, sites = which(richness(coquettes) > 3))
plot(new, show.tip = FALSE)

mkborregaard/nodiv documentation built on April 7, 2023, 9:52 a.m.