mapTraits: Map species trait values in geographic space

Description Usage Arguments Value Author(s) References Examples

View source: R/mapTraitVals.R

Description

mapTraits add species trait values to species distribution in geographic space.

Usage

1
mapTraits(x, trait, FUN = sum, ...)

Arguments

x

A community data object - a vector (with names matching trait data) or a data.frame or matrix (with column names matching names in trait data)

trait

A data.frame of species traits with a column of species names matching species names in the community data, and another column with the trait values.

FUN

The function used to aggregate species trait values in geographic space. By default, if FUN = sum, the sum of all species traits per area or grid cell is calculated.

...

Further arguments passed to or from other methods.

Value

A data frame of species traits by site

Author(s)

Barnabas H. Daru darunabas@gmail.com

References

\insertRef

Daru2015ddibioregion

Examples

1
2
3
4
5
6
7
8
9
require(data.table)
fdir <- system.file("NGAplants", package="bioregion")
files <- file.path(fdir, dir(fdir))
dat <- data.frame(raster2comm(files))
dd <- data.frame(table(dat$species))
names(dd) <- c("species", "range")
trait_range <- dd$range
names(trait_range) <- dd$species
gg <- mapTraits(dat, trait = trait_range, FUN = sd)

darunabas/bioregion documentation built on Oct. 27, 2019, 6:57 a.m.