Learn R Programming

pez (version 1.2-4)

comparative.comm: Creates a community comparative ecology object, the basis of all functions in pez

Description

Basic checking of whether the input data match up is performed; you need only supply comm and phy, nothing else is mandatory. You can manipulate the internals of comparative.comm, or use the wrappers inside pez to keep everything in order. Examples of these features are given below; they are described in detailed at cc.manip.

Usage

comparative.comm(
  phy,
  comm,
  traits = NULL,
  env = NULL,
  warn = TRUE,
  force.root = -1
)

# S3 method for comparative.comm print(x, ...)

Value

comparative.comm object

Arguments

phy

phylogeny (in phylo format) of species

comm

community matrix (as used in vegan) with species as columns and rows as communities. Must contain rownames and colnames; NAs are not checked for but probably unwise.

traits

data.frame of species traits, with rownames matching comm. Saved in the data slot of the resulting comparative.comm object for compatibility with comparative.data.

env

data.frame of environmental data with rownames matching comm

warn

whether to warn if species/sites are dropped when creating object (default: TRUE)

force.root

if phy is unrooted, a root.edge of force.root will be added (default: -1, which means this will never happen). Rarely needed, rarely advisable.

x

comparative.comm object to be printed

...

ignored

Author

Will Pearse

See Also

plot.comparative.comm cc.manip link[caper:comparative.data]{comparative.data}

Examples

Run this code
data(laja)
data <- comparative.comm(invert.tree, river.sites, invert.traits, river.env)
#Subset on species, then sites
data <- data[1:5,]
data <- data[,1:5]
#Site and species can be manipulated
species(data)
sites(data)[1:3] <- c("lovely", "invert", "sites")
#Other data can be viewed
trait.names(data)
env.names(data)
#Get assemblage phylogenies of all sites
assemblage.phylogenies(data)
#Do some manual manipulation of your objects (NOTE: $data for traits)
data$data$new.trait <- sample(letters, nrow(data$comm), replace=TRUE)

Run the code above in your browser using DataLab