Learn R Programming

nodiv (version 1.4.2)

subsample: 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 distrib_data
subsample(x, sites = NULL, species = NULL, ...)
# S3 method for nodiv_data
subsample(x, sites = NULL, species = NULL, node = NULL, ...)
# S3 method for nodiv_result
subsample(x, node = NULL, ...)

Value

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

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

Author

Michael Krabbe Borregaard

See Also

distrib_data, ~~~

Examples

Run this code
## Not run:
data(coquettes)
new <- subsample(coquettes, sites = which(richness(coquettes) > 3))
plot(new, show.tip = FALSE)
## End(Not run)

Run the code above in your browser using DataLab