extraction: Extract environmental data

Description Usage Arguments Examples

View source: R/cracle_build.R

Description

This function is a feature-added wrapper for raster::extract();

Usage

1
2
extraction(data, clim, schema = "raw", factor = 0, rm.outlier = FALSE,
  alpha = 0.01, nmin = 5)

Arguments

data

Distribution data. A data.frame that should include (at least) a column for species/taxon name named 'tax', latitude named 'lat', longitude named 'lon', and an optional column 'sub' if it is necessary to define subgroups (i.e., if 'tax' corresponds to genera but sampling needs to know which records belong to which species. See param 'schema' below).

clim

A raster object (see raster::raster() and raster::stack() documentation for reading raster files into R).

schema

A string of value "raw", "flat", or "species" to define the sampling protocol. In "raw", all records are counted (including duplicate exact localities). In "flat", all unique localities will be counted where a unique locality is defined as a raster grid cell. Under the "flat" sampling strategy two records in the same raster grid cell will be counted as one. The option "species", only applies when taxa are identified as genera and species identities are represented in the "sub" column of the data object. In "species", each unique locality is counted for each species within the group (taxon). This weighs more diverse localities higher. Default is "raw".

factor

An integer value for the methods "flat" and "spec" to increase the systematic sampling grid size to courser resolutions than the given climate grid. The value of factor corresponds to the number of rows and columns to aggregate into each courser grid cell. Default is 0 which will not be processed.

rm.outlier

TRUE or FALSE. Indicate whether to remove points that are climatic outliers for at least one variable given a normal 95 percent confidence interval.

alpha

Confidence level (i.e., 0.05) for clipping out outlier records.

nmin

Minimum number of records allowed. Taxa or groups with fewer records will not be returned.

Examples

1
2
3
4
5
6
7
#distr <- read.table('test_mat.txt', head=T, sep ="\t");
#OR:
data(distr);
data(climondbioclim);
extr.raw = extraction(data=distr, clim= climondbioclim, schema='raw');
extr.flat = extraction(data=distr, clim= climondbioclim, schema='flat');
extr.spec = extraction(data=distr, clim= climondbioclim, schema='species');

rsh249/vegdistmod documentation built on May 28, 2019, 3:31 a.m.