Learn R Programming

pez (version 1.0-0)

cc.manip: Manipulating and examining comparative.comm objects

Description

As described in the vignette, we recommend using these wrappers to manipulate species and site data, as it guarantees that everything will be kept consistent across all parts of the comparative.comm object. With them, you can drop species, sites, and work directly with each part of your data. You an also manipulate your comparative.comm object's phy, data, env, and comm slots directly if you wish, but altering the object directly yourself runs the risk of things getting unsynchronised.

Manipulate internals of comparative.comm object

Usage

## S3 method for class 'comparative.comm':
[(x, sites, spp, warn = FALSE)

trait.names(object)

env.names(object)

species(x)

species(x) <- value

sites(x)

sites(x) <- value

traits(x) <- value

traits(x)

env(x) <- value

env(x)

comm(x) <- value

comm(x)

tree(x)

phy(x)

tree(x) <- value

phy(x) <- value

assemblage.phylogenies(data)

## S3 method for class 'comparative.comm': within(data, expr, ...)

Arguments

x
comparative.comm object
sites
numbers of sites to be kept or dropped from x; must be given as numbers. For example, x[1:5,], or x[-1:-5,], but not x[c("site a", "site b"),].
spp
numbers of species to be kept or dropped from x; must be given as numbers. For example, x[,1:5], or x[,-1:-5], but not x[c("sp a", "sp b"),].
warn
whether to warn if species/sites are dropped when creating object (default: TRUE)
object
value
values to replace object
data
expr
expression to be evaluated within the scope of data
...
ignored

Value

  • Names of the traits or environmental variables

    List of phylo objects, one for each assemblage in the data.

See Also

comparative.comm plot.comaparative.comm

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)
#Add some trait/env data in
traits(data)$new.trait <- sample(letters, nrow(comm(data)), replace=TRUE)
env(data)$new.env <- sample(letters, ncol(comm(data)), replace=TRUE)
#Manipulate/check phylogeny and community matrix
phy(data) #...tree(data) works too...
comm(data)[1,3] <- 3
comm(data) <- comm(data)[-3,]

Run the code above in your browser using DataLab