Learn R Programming

gjam (version 2.6.2)

gjamTrimY: 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'.

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.

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].

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

Run this code
# 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'
# }

Run the code above in your browser using DataLab