graph_matrix: Graphs a set of matrix questions

Description Usage Arguments Examples

Description

Graphs a horizontal stacked bar plot to display information from a series of questions that use the same options (e.g., a matrix).

Usage

1
2
graph_matrix(items, respopts, labels, sort = "entry", mcmo = F,
  ordered = T, palette = NULL, ...)

Arguments

items

Data frame with only items to be graphed

respopts

Vector with the order (low to high) of response options, must be specified even if options are not ordinal

labels

Vector, in order of items columns, with names of items

sort

The order in which items should be displayed upon graphing. Options include: entry - options are in the order of the original columns, alpha - options are in alphabetical order, or one of the response options from respopts, in which case the graph will be sorted descending order by that level

mcmo

Indicator for whether respondents could choose more than one option, default is FALSE

ordered

Specifies if the response options are ordered or not, if ordered, palette is "YlOrRd", if unordered, palette is "Pastel1", can be overridden with palette

palette

Sets custom palette for graphing, overrides defaults from ordered option, see <http://ggplot2.tidyverse.org/reference/scale_brewer.html> for more detail

Examples

1
2
3
4
5
# Graph agree/disagree questions
graph_matrix(survey[get_matchvars(survey, "Opinion_")],
                    respopts=c("Disagree", "Neutral", "Agree"),
                    labels=c("Apples", "Bananas", "Coconuts"),
                    sort="Agree")

rblissett/pubpub documentation built on May 29, 2019, 6:53 p.m.