prepBarData: Prepare and print basic statistics for niceBar

View source: R/np_data_processing.R

prepBarDataR Documentation

Prepare and print basic statistics for niceBar

Description

Processess the input data, factors, and options to produce summary data for drawing bar plots

Usage

prepBarData(
  x,
  by,
  errorMultiple = 1,
  upperErrorFun = "sd",
  lowerErrorFun = upperErrorFun,
  aggFunction = "mean",
  stack = FALSE,
  subgroup = FALSE
)

Arguments

x

list; a list object returned by prepCategoryWindow

by

factor or dataframe of factors; One or more factors that control how the data is grouped. The first column is the primary grouping factor and the second and thrid columns are used for sub-grouping and/or stacking as needed.

errorMultiple

numeric; How many standard errors/deviations should be represented by the error bars.

upperErrorFun

character string; Determines how the error barse are calculated. Options are sd (standard deviation), se (standard error), min, max and boot95ci (bootstrap 95% confidence interval).

lowerErrorFun

character; A character vector for the primary group names

aggFunction

character string; An string naming the function to be used to aggregate the grouped data. Typically should be either median or mean.

stack

logical; Should one of the factors in by be used make a stacked bar plot. Note that this sort of analysis is nonsensical for many data sets.

subgroup

logical; If TRUE the data will be faceted into subgroups within the primary factor levels. Ignored if by is a factor or x is a data.frame.

Details

todo<-1

See Also

niceBar, boot95ci, drawBar

Examples

todo<-1


ZachHunter/NicePlots.R documentation built on Sept. 23, 2023, 4:04 a.m.