ggadd_interaction {GDAtools} | R Documentation |
Plot of interactions between two categorical supplementary variables
Description
Adds the interactions between two categorical supplementary variables to a MCA cloud of variables
Usage
ggadd_interaction(p, resmca, v1, v2, sel1 = 1:nlevels(v1), sel2 = 1:nlevels(v2),
axes = c(1,2), textsize = 5, legend = "right")
Arguments
p |
|
resmca |
object of class |
v1 |
Factor. The first categorical supplementary variable. |
v2 |
Factor. The second categorical supplementary variable. |
sel1 |
Numeric vector of indexes of the categories of the first supplementary variable to be used in interaction. By default, every categories are used. |
sel2 |
Numeric vector of indexes of the categories of the second supplementary variable to be used in interaction. By default, every categories are used. |
axes |
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2). |
textsize |
Size of the labels of categories. Default is 5. |
legend |
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector). Default is right. |
Value
a ggplot2
object
Note
Lines and labels are colored according to the variables, using the default ggplot2
palette. The palette can be customized using any scale_color_*
function, such as scale_color_brewer()
, scale_color_grey()
or scale_color_manual()
.
Author(s)
Nicolas Robette
References
Le Roux B. and Rouanet H., Multiple Correspondence Analysis, SAGE, Series: Quantitative Applications in the Social Sciences, Volume 163, CA:Thousand Oaks (2010).
Le Roux B. and Rouanet H., Geometric Data Analysis: From Correspondence Analysis to Stuctured Data Analysis, Kluwer Academic Publishers, Dordrecht (June 2004).
See Also
ggcloud_variables
, ggadd_supvar
, ggadd_supvars
, ggadd_kellipses
, ggadd_ellipses
, ggadd_corr
, ggsmoothed_supvar
, ggadd_chulls
, ggadd_density
Examples
# specific MCA of Taste example data set
data(Taste)
junk <- c("FrenchPop.NA", "Rap.NA", "Rock.NA", "Jazz.NA", "Classical.NA",
"Comedy.NA", "Crime.NA", "Animation.NA", "SciFi.NA", "Love.NA",
"Musical.NA")
mca <- speMCA(Taste[,1:11], excl = junk)
# interaction between Gender and Age
p <- ggcloud_variables(mca, col = "lightgrey", shapes = FALSE)
ggadd_interaction(p, mca, Taste$Gender, Taste$Age)