diversity | R Documentation |
This function produces maps of diversity based on a fitted tree object of class
dpart
.
diversity(object, newdata = NULL, too.far = 0.1, LatID, LonID,
projection = "+proj=longlat +datum=WGS84", maxpixels = 1e+05,
col = "lightgrey", fill = "lightgrey", zlim = c(0, 1))
## S3 method for class 'dpart'
diversity(object, newdata = NULL, too.far = 0.1, LatID,
LonID, projection = "+proj=longlat +datum=WGS84", maxpixels = 1e+05,
col = "lightgrey", fill = "lightgrey", zlim = c(0, 1))
object |
fitted tree object of class |
newdata |
optional new dataset to base the diversity estimates on. By default, the dataset used to create the tree is used. |
too.far |
too.far |
LatID |
column labelling the latitude co-ordinate |
LonID |
column labelling the longitude co-ordinate |
projection |
projection |
maxpixels |
maxpixels |
col |
col |
fill |
fill |
zlim |
zlim |
Depending on the extent of the data collected and co-ordinate system required, "world2" may produce a better map than "world".
Two maps showing the diversity of predators diet spanning the sampled locations.
The first map shows the diversity for each sampled point represented by a colour matched
to a 0-1 scale. The second plot shows the interpolated diversity from fitting a GAM
(see mgcv
) to the diversity score with smooth terms for latitude and longitude.
A data frame listing the latitude, longitude, diversity, diversity bin and associated
colours.
Kuhnert, P.M., Duffy, L. M and Olson, R.J. (2012) The Analysis of Predator Diet and Stable Isotope Data, Journal of Statistical Software, In Prep.
mgcv
, mappoints.data
, map
# Assigning prey colours for default palette
val <- apc(x = yftdiet, preyfile = PreyTaxonSort, check = TRUE)
node.colsY <- val$cols
dietPP <- val$x # updated diet matrix with Group assigned prey taxa codes
# Fitting the classification tree
yft.dp <- dpart(Group ~ Lat + Lon + Year + Quarter + SST + Length,
data = dietPP, weights = W, minsplit = 10,
cp = 0.001)
yft.pr <- prune(yft.dp, se = 1)
diversity(object = yft.pr, LatID = "Lat", LonID = "Lon", too.far = 0.05,
projection = "+proj=longlat +datum=WGS84", maxpixels = 1e5,
col = "black", fill = "lightgrey")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.