View source: R/ggadd_attractions.R

ggadd_attractions | R Documentation |

Adds attractions between categories, as measured by phi coefficients or percentages of maximum deviation (PEM), by plotting segments onto a MCA cloud of variables, using the ggplot2 framework.

ggadd_attractions(p, resmca, axes=c(1,2), measure="phi", min.asso=0.3, col.segment="lightgray", col.text="black", text.size=3)

`p` |
ggplot object with the cloud of variables |

`resmca` |
object of class |

`axes` |
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2). |

`measure` |
character. The measure for attractions: "phi" (default) for phi coefficients, "pem" for percentages of maximum deviation (PEM). |

`min.asso` |
numerical value between 0 and 1. The minimal attraction value for segments to be plotted. Default is 0.3. |

`col.segment` |
Character. Color of the segments. Default is lightgray. |

`col.text` |
Character. Color of the labels of the categories. Default is black. |

`text.size` |
Size of the labels of categories. Default is 3. |

a ggplot object

Nicolas Robette

Cibois, Philippe. *Les méthodes d’analyse d’enquêtes*. Nouvelle édition [en ligne]. Lyon: ENS Éditions, 2014. Disponible sur Internet : <http://books.openedition.org/enseditions/1443>

`ggcloud_variables`

, `ggcloud_indiv`

, `ggadd_ellipses`

, `ggadd_corr`

, `ggadd_interaction`

, `ggadd_density`

## Performs a specific MCA on 'Taste' example data set ## ignoring every 'NA' (i.e. 'not available') categories, ## draws the cloud of categories ## and adds segments between categories with attractions. data(Taste) getindexcat(Taste[,1:11]) mca <- speMCA(Taste[,1:11],excl=c(3,6,9,12,15,18,21,24,27,30,33)) p <- ggcloud_variables(mca, col="white", legend="none") ggadd_attractions(p, mca, measure="phi", min.asso=0.1)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.