ordinate | R Documentation |
This is a convenience function to fit an ordination model to a data object, wrap the result as a tbl_ord, and annotate this output with metadata from the model and possibly from the data.
ordinate(x, model, ...) ## Default S3 method: ordinate(x, model, ...) ## S3 method for class 'array' ordinate(x, model, ...) ## S3 method for class 'table' ordinate(x, model, ...) ## S3 method for class 'data.frame' ordinate(x, model, cols, augment, ...) ## S3 method for class 'dist' ordinate(x, model, ...)
x |
A data object to be passed to the |
model |
An ordination function whose output is coercible to class
'tbl_ord', or a symbol or character string (handled by |
... |
Additional arguments passed to |
cols |
< |
augment |
< |
The default method fits the specified model to the provided data object,
wraps the result as a tbl_ord, and augments this output with any intrinsic
metadata from the model via augment_ord()
.
The default method is used for most classes, though this may change in future. The data.frame method allows the user to specify what columns to include in the model and what columns with which to annotate the output.
An augmented tbl_ord.
# LRA of arrest data ordinate(USArrests, cols = c(Murder, Rape, Assault), lra) # CMDS of inter-city distance data ordinate(UScitiesD, cmdscale_ord, k = 3L) # PCA of iris data ordinate(iris, princomp, cols = -Species, augment = c(Sepal.Width, Species)) ordinate(iris, cols = 1:4, ~ prcomp(., center = TRUE, scale. = TRUE)) # CA of hair & eye color data haireye <- as.data.frame(rowSums(HairEyeColor, dims = 2L)) ordinate(haireye, MASS::corresp, cols = everything()) # FA of Swiss social data ordinate(swiss, model = factanal, factors = 2L, scores = "Bartlett") # LDA of iris data ordinate(iris, ~ lda_ord(.[, 1:4], .[, 5], ret.x = TRUE)) # CCA of savings data ordinate( LifeCycleSavings[, c("pop15", "pop75")], # second data set must be handled as an additional parameter to `model` y = LifeCycleSavings[, c("sr", "dpi", "ddpi")], model = cancor_ord, scores = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.