cc.manip {pez} | R Documentation |
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 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'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
abundance.weighted = FALSE,
...
)
## S3 method for class 'comparative.comm'
within(data, expr, ...)
Arguments
x |
|
sites |
numbers of sites to be kept or dropped from |
spp |
numbers of species to be kept or dropped from |
warn |
whether to warn if species/sites are dropped when creating object (default: TRUE) |
object |
A |
value |
when altering a |
data |
A |
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
|
Value
Names of the traits or environmental variables
Note
As described in comparative.comm
, each
comparative.comm
object contains a phylogeny
($phy
) and a site-by-species community matrix (as used in
vegan
). Optionally, it may contain a
data.frame
of trait data (each row a species, each column a
trait ) *called data
* for compatibility with
comparative.data
.
See Also
comparative.comm plot.comaparative.comm
Examples
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,]