distrib_data: Data objects for node-based analysis

View source: R/Prepare_data.R

distrib_dataR Documentation

Data objects for node-based analysis

Description

Functions to collect and display data with matching species distributions and phylogenies

Usage

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 class 'distrib_data'
summary(object, ...)
## S3 method for class 'nodiv_data'
summary(object, ...)
## S3 method for class 'distrib_data'
plot(x, ...)
## S3 method for class 'nodiv_data'
plot(x,  ...)
## S3 method for class 'distrib_data'
identify(x,  ...)

Arguments

phylo

A phylogeny in ape's phylo format, with tip.labels that correspond to the species names in commatrix

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.

coords

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.

proj4string_in

Projection string as defined in package sp

type

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.

shape

An optional shapefile to overlay plots upon.

object

An object of type distrib_data or nodiv_data

x

An object of type distrib_data or nodiv_data

...

Further arguments to be passed to the plotting function

Details

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.

Value

The distrib_data function produces an object of type distrib_data, which has the following components:

coords

A SpatialPointsDataFrame or SpatialPixelsDataFrame (from sp) with spatial coordinates, and one column named sites containing the site names

comm

The community matrix

type

A character vector describing the type of data

species

A list of species names

shape

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:

phylo

A phylogeny of type phylo from package ape

Author(s)

Michael Krabbe Borregaard

See Also

Node_analysis


mkborregaard/nodiv documentation built on April 7, 2023, 9:52 a.m.