Learn R Programming

sjPlot (version 2.0.0)

sjp.gpt: Plot grouped proportional tables

Description

Plot grouped proportional crosstables, where the proportion of each level of x for the highest category in y is plotted, for each subgroup of groups.

Usage

sjp.gpt(x, y, groups, geom.colors = "Set1", geom.size = 2.5,
  shape.fill.color = "#f0f0f0", shapes = c(15, 16, 17, 18, 21, 22, 23, 24,
  25, 7, 8, 9, 10, 12), title = NULL, axis.labels = NULL,
  axis.titles = NULL, legend.title = NULL, legend.labels = NULL,
  wrap.title = 50, wrap.labels = 15, wrap.legend.title = 20,
  wrap.legend.labels = 20, axis.lim = NULL, grid.breaks = NULL,
  show.total = TRUE, annotate.total = TRUE, show.p = TRUE,
  show.n = TRUE, prnt.plot = TRUE)

Arguments

Value

(Insisibily) returns the ggplot-object with the complete plot (plot) as well as the data frame that was used for setting up the ggplot-object (df).

Details

The p-values are based on chisq.test of x and y for each groups.

Examples

Run this code
library(sjmisc)
data(efc)

# the proportion of dependency levels in female
# elderly, for each family carer's relationship
# to elderly
sjp.gpt(efc$e42dep, efc$e16sex, efc$e15relat)

# proportion of educational levels in highest
# dependency category of elderly, for different
# care levels
sjp.gpt(efc$c172code, efc$e42dep, efc$n4pstu)

Run the code above in your browser using DataLab