Description Usage Arguments Author(s) See Also Examples
View source: R/ggPredictor.plot.R
Create bar plot of counts for each level of a set of categorical predictor variables. Bars are colored by a binary response, and percentages of first level of response are superimposed onto the bars.
1 2 3 4 | ggPredictor.plot(data, response, vars, ...)
## Default S3 method:
ggPredictor.plot(data, response, vars,
size = 4, color = "black", hjust = 1.1)
|
data |
a dataframe |
response |
character. The name of the column containing the response variable to be predicted. |
vars |
either a character vector of predictor column names or a numeric vector of column indices. |
size |
numeric. Size of the percentage annotations. |
color |
color of the annotation text. |
hjust |
horizontal justification of annotation text. |
Jason Grafmiller
1 2 3 4 5 6 7 8 9 10 11 12 13 | data(brown_genitives)
## plot the percentages of s- vs. of-genitives by
## genre, possessor animacy, and final sibilancy
ggPredictor.plot(brown_genitives, "Type",
c("Genre", "PossrAnimacyBin", "FinalSibilant"))
## same thing using column indices:
ggPredictor.plot(brown_genitives, "Type", c(3, 19, 10))
## same thing using column indices:
ggPredictor.plot(brown_genitives, "Type", c(3, 19, 10)) +
scale_fill_brewer(palette = "Set2")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.