pez (version 1.2-4)

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 can 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.

Usage

# S3 method for 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 comparative.comm as.data.frame( x, row.names = NULL, optional = FALSE, abundance.weighted = FALSE, ... )

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

Value

Names of the traits or environmental variables

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

A comparative.comm object

value

when altering a comparative.comm object's internal structure, the thing that you're inserting into it!

data

A comparative.comm object

row.names

ignored

optional

ignored presence-absence dataset (default: FALSE)

abundance.weighted

whether to create to create a

...

ignored

expr

expression to be evaluated within the scope of 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 DataCamp Workspace