
Last chance! 50% off unlimited learning
Sale ends in
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,
...
)
List with reduced dataframe and possible plots.
Dataframe
Integer. Number of dimensions to reduce to.
Character vector. Names of columns to ignore.
Vector. Which columns do you wish to plot? Select which two variables by name or column position.
Boolean. Keep quiet? If not, print messages.
Boolean. Create plots?
Additional parameters passed to stats::prcomp
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")
Run the code above in your browser using DataLab