formultipleplot: Summarise a 'select multiple' variable for plotting

View source: R/summary_for_multiple_response_plots.R

formultipleplotR Documentation

Summarise a 'select multiple' variable for plotting

Description

Function to summarise variable that allows multiple responses from CES and prepare for plotting

Usage

formultipleplot(data, ..., out)

Arguments

...

Grouping variable(s)

out

An outcome variable where more than one response can be selected

A

dataframe containing grouping variables and outcome variable

Value

A summary tibble in long format for ggplot of n, total and percentage (n/total) where n is frequency of each level within the outcome variable and total is the sum of n, grouped by grouping variable(s). NAs are included because this function is often applied to follow-up questions to a binary question. If NAs were excluded, reader won't know what the calculated percentage may be skewed to the readers as it becomes unclear what the percentage is expressed on.

Examples

When using function, need to specify out = otherwise function will assume it is a grouping variable

SCIFoundation/sciCoverageR documentation built on Oct. 31, 2024, 11:45 p.m.