Learn R Programming

metricTester (version 1.2.2)

plotContents: Identify individuals contained within a plot

Description

Given a spatially explicit data frame of individual locations in a simulated arena, and the bounds of a series of plots, identifies the contents of each plot.

Usage

plotContents(arena, plotPlacer.results)

Arguments

arena
Data frame of three columns: "individuals", "X", and "Y"
plotPlacer.results
The results of a call to plotPlacer. A list with two elementers. The first is a matrix of X Y coordinates of plots. The second is a symmetrical distance matrix summarizing the distances among these plots.

Value

A matrix with species as rows and plots as columns.

Details

Takes a data frame like that returned from filteringArena(), and a matrix like that returned from plotPlacer(), and returns the resulting community data matrix such as might be generated by someone surveying a forest plot. Plots with < 2 species are excluded from the CDM.

References

Miller, E. T., D. R. Farine, and C. H. Trisos. 2015. Phylogenetic community structure metrics and null models: a review with new methods and software. bioRxiv 025726.

Examples

Run this code
tree <- geiger::sim.bdtree(b=0.1, d=0, stop="taxa", n=50)

temp <- evolveTraits(tree)

phydistmatrix <- ape::cophenetic.phylo(temp[[1]])

#define a color for each species
cols <- colorRamps::blue2green2red(nrow(phydistmatrix))

#prep the data for the simulation
prepped <- prepSimulations(tree, arena.length=300, mean.log.individuals=2, 
length.parameter=5000, sd.parameter=50, max.distance=20, proportion.killed=0.2,
competition.iterations=3)

singleArena <- filteringArena(prepped)

#plot the arena. don't close the window
plot(singleArena$arena$X, singleArena$arena$Y, pch=20, cex=0.5, xlim=c(0,300), 
ylim=c(0,300), col=cols[singleArena$arena$individuals])

boundResults <- plotPlacer(no.plots=10, arena.length=300, plot.length=50)

plotPlotter(boundResults$plot.bounds)

#return a CDM in picante format
cdm <- plotContents(singleArena$arena, boundResults)

Run the code above in your browser using DataLab