Extract CoCA species loadings from fitted objects.

loadings(x, ...)

# S3 method for predcoca
loadings(x, choices = c(1, 2),
         which = c("response", "predictor"), ...)

# S3 method for symcoca
loadings(x, choices = c(1, 2),
         which = c("y1", "y2"), ...)

Arguments

x

an object resulting from a call to coca.

choices

numeric; vector of Co-CA axes to extract loadings for.

which

character; should the response or predictor scores be plotted. Can be specified in several ways: response choices are one from c("y", "Y", "y1", "response"); predictor choices are one from c("x", "X", "y2", "predictor").

...

additional arguments to be passed to lower level methods.

Details

loadings() is an extractor function to access the loadings of a fitted CoCA model.

This is a generic function, replacing the loadings function, which is preserved as the exported default S3 method. Methods are provided for both predictive and symmetric CoCA.

Value

A list of data frames or a single data frame depending on other arguments.

Author

Gavin L. Simpson

See also

coca for how to fit CoCA models.

Examples

## symmetric CoCA
data(beetles)
## log transform the bettle data
beetles <- log(beetles + 1)
data(plants)
## fit the model
bp.sym <- coca(beetles ~ ., data = plants, method = "symmetric")
#> 
#> Removed some species that contained no data in: beetles, plants 

## extract the loadings
lds <- loadings(bp.sym)