HCPC_tab {ggfacto}R Documentation

Multiple Tables for Hierarchical Clusters

Description

Multiple Tables for Hierarchical Clusters

Usage

HCPC_tab(
  data,
  row_vars = character(),
  clust,
  wt,
  excl = character(),
  color = "diff",
  pct = "col",
  row_tot = "% of population",
  ...
)

Arguments

data

A data frame.

row_vars

<tidy-select> The row variables of the table, to cross with the clusters. Typically, actives variables of the MCA.

clust

In columns, the variable with the clusters, typically made with hierarchical clustering functions like HCPC (object 'res$data.clust$clust'). Can be either a symbol or a character vector of length 1 (for vars in 'data'), or an external variable (not in 'data') provided its length is equal to the number of rows of 'data'.

wt

The name of the weight variable. Leave empty for unweighted results.

excl

The name of the levels to exclude, as a character vector.

color

The type of colors to print, see tab.

pct

The type of percentages to print, see tab. Default to column percentages

row_tot

The name of the total line (frequencies of each cluster)

...

Additional arguments to pass to tab_many.

Value

A tibble of class tab, possibly with colored reading helpers.

Examples


data(tea, package = "FactoMineR")
res.mca_3axes <- MCA2(tea, active_vars = 1:18, ncp = 3)
cah <- FactoMineR::HCPC(res.mca_3axes, nb.clust = 6, graph = FALSE)
tea$clust <- cah$data.clust$clust
HCPC_tab(tea, row_vars = all_of(names(tea)[1:18]), clust = "clust") #|>
#tabxplor::tab_kable()


[Package ggfacto version 0.3.0 Index]