ggmca_with_base_ref {ggfacto}R Documentation

Plot Initial Dimensions (Active Variables) on a Multiple Correspondence Analyses

Description

This function mostly have an educational value : it shows the initial dimensions of the Multiple Correspondence Analysis (active variables) in the space built by the analysis (principal axes). To see initial dimensions in their initial reference frame, use ggmca_initial_dims.

Usage

ggmca_with_base_ref(res.mca = res.mca, axes = c(1, 2), keep = NULL)

Arguments

res.mca

An object created with FactoMineR::MCA.

axes

The axes to print, as a numeric vector of length 2.

keep

A character vector of the name of active variables to keep.

Value

A ggplot object to be printed in the 'RStudio' Plots pane. Possibility to add other gg objects with +. Sending the result through ggi will draw the interactive graph in the Viewer pane using ggiraph.

Examples


data(tea, package = "FactoMineR")
res.mca <- MCA2(tea, active_vars = 1:18)
ggmca_with_base_ref(res.mca)

# It is more readable to select just a few active variables
lv2_vars <- dplyr::select(tea[1:18], where(~ nlevels(.) == 2)) |> names()
ggmca_with_base_ref(res.mca, keep = lv2_vars)

lv3_vars <- dplyr::select(tea[1:18], where(~ nlevels(.) == 3)) |> names()
ggmca_with_base_ref(res.mca, keep = lv3_vars)

lv4_vars <- dplyr::select(tea[1:18], where(~ nlevels(.) == 4)) |> names()
ggmca_with_base_ref(res.mca, keep = lv4_vars)

lv6_vars <- dplyr::select(tea[1:18], where(~ nlevels(.) == 6)) |> names()
ggmca_with_base_ref(res.mca, keep = lv6_vars)


[Package ggfacto version 0.3.0 Index]