ggPredictor.plot: Bar blots of predictors in a model

Description Usage Arguments Author(s) See Also Examples

View source: R/ggPredictor.plot.R

Description

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.

Usage

1
2
3
4
ggPredictor.plot(data, response, vars, ...)
## Default S3 method:
ggPredictor.plot(data, response, vars,
	size = 4, color = "black", hjust = 1.1)

Arguments

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.

Author(s)

Jason Grafmiller

See Also

geom_bar.

Examples

 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")

jasongraf1/JGmermod documentation built on May 24, 2019, 9:54 p.m.