View source: R/dim_reduction.R
reduce_pca | R Documentation |
Principal component analysis or (PCA) is a method we can use to reduce high-dimensional data to a low-dimensional space. In other words, we cannot accurately visualize high-dimensional datasets because we cannot visualize anything above 3 features. The main purpose behind PCA is to transform datasets with more than 3 features (high-dimensional) into typically a 2/3 column dataset. Despite the reduction into a lower-dimensional space we still can retain most of the variance or information from our original dataset.
reduce_pca(
df,
n = NULL,
ignore = NULL,
comb = c(1, 2),
quiet = FALSE,
plot = TRUE,
...
)
df |
Dataframe |
n |
Integer. Number of dimensions to reduce to. |
ignore |
Character vector. Names of columns to ignore. |
comb |
Vector. Which columns do you wish to plot? Select which two variables by name or column position. |
quiet |
Boolean. Keep quiet? If not, print messages. |
plot |
Boolean. Create plots? |
... |
Additional parameters passed to |
List with reduced dataframe and possible plots.
Other Dimensionality:
reduce_tsne()
Other Clusters:
clusterKmeans()
,
clusterOptimalK()
,
clusterVisualK()
,
reduce_tsne()
Sys.unsetenv("LARES_FONT") # Temporal
data("iris")
df <- subset(iris, select = c(-Species))
df$id <- seq_len(nrow(df))
reduce_pca(df, n = 3, ignore = "id")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.