biodiversity: Create a biodiversity data object

View source: R/biodiversity.R

biodiversityR Documentation

Create a biodiversity data object

Description

This function creates a simple data structure to hold biodiversity data, including taxa occurrence data, data about the sites or samples that the taxa were observed at, data on the traits of the taxa observed, and a phylo4 object (from the phylobase package) containing the taxa phylogeny.

Usage

biodiversity(
  sample,
  taxon,
  count,
  site = NULL,
  site.data = NULL,
  trait = NULL,
  trait.data = NULL,
  phylo = NULL
)

## S3 method for class 'biodiversity'
getSamples(x, pa = F, ...)

## S3 method for class 'biodiversity'
getSites(x, ...)

## S3 method for class 'biodiversity'
getSites(x, ...)

## S3 method for class 'biodiversity'
getTraits(x, ...)

## S3 method for class 'biodiversity'
print(x, ...)

Arguments

sample

a site/sample identifier describing the unit of data collection for the study.

taxon

a taxon identfier that uniquely describes each taxon.

count

a vector of counts of individuals

site

a two sided formula describing the site data to use. The left hand side should contain the site/sample identifiers that match the sample argument. The right hand side contains the variables to use.

site.data

a data.frame containing site data

trait

a two sided formula describing the traits to store from the trait.data data.frame. The left hand side contains taxa identifiers that match the taxon argument.

trait.data

a data.frame containing trait data

phylo

a phylo4 object containing a phylogeny for the the taxa present in the taxon variable

x

a biodiversity object

pa

logical; if T presence absence data is returned rather than counts

Details

Many R packages and functions for phylogenetic or diversity analyses require the data to be in formats something like these. This function ensures that the taxa and sites match among all the elements and provides warnings (or errors in some cases) if they don't.


jasonelaw/RIVPACS documentation built on Sept. 27, 2022, 6:34 p.m.