Learn R Programming

spacodiR (version 0.13.0115)

match.spacodi.data: pruning a tree to match datasets used in SPACoDi

Description

match.spacodi.data is a utility for automating the process of pruning datasets for use in spacodiR. Note that nearly all spacodiR functions require that trees have present (at least) all species sampled in the community dataset.

Usage

match.spacodi.data(sp.plot, phy=NULL, sp.traits=NULL, prune=TRUE, verbose=FALSE)

Arguments

sp.plot
a community dataset in spacodiR format (see as.spacodi)
phy
a phylogenetic tree of class phylo; see read.tree
sp.traits
a species-by-trait(s) dataframe
prune
Boolean; whether plots with fewer than two species sampled are pruned
verbose
Boolean; whether dropped plots are written to the console

Value

A list of pruned dataset(s):
  • sp.plot
  • sp.tree
  • sp.traits
Note: if prune=TRUE, the list of plots pruned will be printed to the console.

Examples

Run this code
# load a species-by-plots matrix, along with a tree
data(sp.example)
attributes(sp.example)
attach(sp.example)
spl
phy
trt

# prune out undersampled plots
spl[,2]=0
match.spacodi.data(spl) -> sp.plot.new
sp.plot.new


# match datasets where sp.traits is smaller than the remainder
match.spacodi.data(sp.plot=spl, phy=phy, sp.traits=trt[1:6,])
							

Run the code above in your browser using DataLab