forplot: Summarise a 'select one' variable for plotting

View source: R/summary_for_plots.R

forplotR Documentation

Summarise a 'select one' variable for plotting

Description

Function to summarise variables from CES and prepare for plotting

Usage

forplot(data, ..., out, dropna = c(FALSE, TRUE), number = c(FALSE, TRUE))

Arguments

data

A dataframe containing grouping variables and outcome variable

...

Grouping variable(s)

out

An outcome variable

dropna

Should NAs be dropped from dataframe?

number

Is the type of outcome variable numeric?

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)

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.