knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
Extract and visualize FactoMineR results. This package provides several methods for plotting and summarizing results of multivariate exploratory data analysis (e.g. PCA, CA). FactoHelpeR uses ggplot2, this makes it easy to customize plots (e.g. using themes, stat and scales).
This package only supports Principal Component Analysis (PCA) and Correspondence Analysis (CA).
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("nfrerebeau/FactoHelpeR")
FactoHelpeR provides a set of S3 methods to explore the results of multivariate data analysis from FactoMineR:
extract()
returns the requested part of the results,summarize()
returns summaries of the results,visualize()
plots individuals or variables map with extra informations.library(FactoHelpeR) library(FactoMineR) # PCA data(decathlon) results <- FactoMineR::PCA(decathlon, scale.unit = TRUE, quanti.sup = 11:12, quali.sup = 13, graph = FALSE)
# Extract individuals coordinates ind_coord <- extract(results, "ind coord") head(ind_coord)
# Summarize results for the first 5 active variables along the first component (ind <- summarize(results, "var", rows = 1:5, axes = 1))
# Plot individuals visualize(results, map = "ind", axes = c(1, 2), group = 13) + ggplot2::labs(title = "Individuals map") + ggplot2::theme_bw() # Plot variables and supplementary categories visualize(results, map = "variables", axes = c(1, 2), extra = c("quanti", "quali")) + ggrepel::geom_label_repel(size = 3, segment.colour = "grey", seed = 123) + ggplot2::labs(title = "Variables map") + ggplot2::theme_bw()
# Plot eigenvalues and cumulative percentage of variance visualize(results, map = "eig") + ggplot2::theme_bw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.