plotContents: Identify individuals contained within a plot

Description Usage Arguments Details Value References Examples

View source: R/plotContents.R

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

1
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 elements. The first is a matrix of X Y coordinates of plots. The second is a symmetrical distance matrix summarizing the distances among these plots.

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.

Value

A matrix with species as rows and plots as columns.

References

Miller, E. T., D. R. Farine, and C. H. Trisos. 2016. Phylogenetic community structure metrics and null models: a review with new methods and software. Ecography DOI: 10.1111/ecog.02070

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 <- plotrix::color.scale(x=1:nrow(phydistmatrix),
cs1=c(0.2,0.4,0.8), cs2=c(0,0.5,0.8), cs3=c(1,0.5,0))

#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=1, 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)

eliotmiller/metricTester documentation built on Dec. 16, 2019, 12:39 p.m.