Functions to collect and display data with matching species distributions and phylogenies
distrib_data(commatrix, coords = NULL, proj4string_in = CRS(as.character(NA)),
type = c("auto", "grid", "points"), shape = NULL)
nodiv_data(phylo, commatrix, coords, proj4string_in = CRS(as.character(NA)),
type = c("auto", "grid", "points"), shape = NULL)
# S3 method for distrib_data
summary(object, ...)
# S3 method for nodiv_data
summary(object, ...)
# S3 method for distrib_data
plot(x, ...)
# S3 method for nodiv_data
plot(x, ...)
# S3 method for distrib_data
identify(x, ...)
The distrib_data
function produces an object of type distrib_data
, which has the following components:
A SpatialPointsDataFrame
or SpatialPixelsDataFrame
(from sp
) with spatial coordinates, and one column named sites
containing the site names
The community matrix
A character vector describing the type of data
A list of species names
An optional slot detailing a shapefile object for plotting the data
The nodiv_data
function produces an object of type nodiv_data
, which contains the additional component:
A phylogeny of type phylo
from package ape
A phylogeny in ape's phylo format, with tip.labels that correspond to the species names in commatrix
A community matrix or data.frame of species distributions, with species as columns, sites as rows, and 0/1 denoting the absence or presence of a species in a given site. Alternatively, the functions accept a data.frame
in the phylocom format, i.e. with three columns containing plot id, abundance (ignored) and species id. The nodiv_data
function also accepts an object of type distrib_data
, in which case coords
is ignored. The nodiv_data
function matches the species in the matrix to the tips of phylo
.
The coordinates of all sites in the data. The input can be of a variety of different formats. Can be a data.frame
or matrix
with two columns. If more columns are present, the function will search for typical coordinate names such as X/Y or Lon/Lat. Alternatively, an object inheriting from SpatialPoints
from package sp
is accepted. The coordinates are transformed to SpatialPoints
using the proj4string argument. Site names can be given as a third column of the data.frame, as rownames for the matrix or omitted. If site names are given, and commatrix
has row.names, these are matched.
Projection string as defined in package sp
A descriptor of whether the sites are point (community) sites, or the centres of regular grid cells. If omitted or set to auto
, the function will guess the type from coords
.
An optional shapefile to overlay plots upon.
An object of type distrib_data or nodiv_data
An object of type distrib_data or nodiv_data
Further arguments to be passed to the plotting function
Michael Krabbe Borregaard
When making an object of type 'grid', the coordinates will be stored as SpatialPixels
from package sp
. This may result in a warning if there are rows or columns in the grid without data. The function removes these. This may affect plotting, but can otherwise be ignored.
Node_analysis