View source: R/dim-reduction.R
remove_components | R Documentation |
Reconstruct data after removing principal components. This function will reconstruct a truncated version of the original data matrix after removing the specified principal components. The source code for this function was stolen from stack exchange
remove_components(x, components = 1, ...)
x |
data.frame or matrix of original data. |
components |
numeric vector of components to remove from original data. Default (1) |
... |
Additional arguments passed to |
data.frame of values in the original units after removing components
# Remove first two components from dataset
trunc <- remove_components(USArrests, components = 1:2, scale. = TRUE, center = TRUE)
# original data
head(USArrests)
# reconstructed data
head(trunc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.