gjamTrimY: Trim gjam response data

View source: R/gjamTrimY.r

gjamTrimYR Documentation

Trim gjam response data

Description

Returns a list that includes a subset of columns in y. Rare species can be aggregated into a single class.

Usage

  gjamTrimY(y, minObs = 2, maxCols = NULL, OTHER = TRUE)

Arguments

y

n by S numeric response matrix

minObs

minimum number of non-zero observations

maxCols

maximum number of response variables

OTHER

logical or character string. If OTHER = TRUE, rare species are aggregated in a new column 'other'. A character vector contains the names of columns in y to be aggregated with rare species in the new column 'other'.

Details

Data sets commonly have many responses that are mostly zeros, large numbers of rare species, even singletons. Response matrix y can be trimmed to include only taxa having > minObs non-zero observations or to <= maxCol total columns. The option OTHER is recommended for composition data ('CC', 'FC'), where the 'other' column is taken as the reference class. If there are unidentified species they might be included in this class. [See gjamSimData for typeName codes].

Value

Returns a list containing three elements.

y

trimmed version of y.

colIndex

length-S vector of indices for new columns in y.

nobs

number of non-zero observations by column in y.

Author(s)

James S Clark, jimclark@duke.edu

References

Clark, J.S., D. Nemergut, B. Seyednasrollah, P. Turner, and S. Zhang. 2017. Generalized joint attribute modeling for biodiversity analysis: Median-zero, multivariate, multifarious data. Ecological Monographs 87, 34-56.

See Also

gjamSimData simulates data gjam analyzes data

A more detailed vignette is can be obtained with:

browseVignettes('gjam')

web site 'http://sites.nicholas.duke.edu/clarklab/code/'.

Examples

## Not run: 
library(repmis)
source_data("https://github.com/jimclarkatduke/gjam/blob/master/forestTraits.RData?raw=True")

y   <- gjamReZero(fungEnd$yDeZero)     # re-zero data
dim(y)
y   <- gjamTrimY(y, minObs = 200)$y    # species in >= 200 observations
dim(y)
tail(colnames(y))    # last column is 'other'

## End(Not run)

gjam documentation built on May 24, 2022, 1:06 a.m.