superbPlot.raincloud: superbPlot 'raincloud' layout

View source: R/functionsPlotting_advanced.R

superbPlot.raincloudR Documentation

superbPlot 'raincloud' layout

Description

The raincloud layout display jittered dots as well as a "cloud" (half of a violin) above them. See Allen, Poggiali, Whitaker, Marshall, & Kievit (2018) The functions has these parameters:

Usage

superbPlot.raincloud(
  summarydata,
  xfactor,
  groupingfactor,
  addfactors,
  rawdata = NULL,
  violinParams = list(),
  jitterParams = list(),
  pointParams = list(),
  errorbarParams = list(),
  facetParams = list(),
  xAsFactor = TRUE
)

Arguments

summarydata

a data.frame with columns "center", "lowerwidth" and "upperwidth" for each level of the factors;

xfactor

a string with the name of the column where the factor going on the horizontal axis is given;

groupingfactor

a string with the name of the column for which the data will be grouped on the plot;

addfactors

a string with up to two additional factors to make the rows and columns panels, in the form "fact1 ~ fact2";

rawdata

always contains "DV" for each participants and each level of the factors

violinParams

(optional) list of graphic directives that are sent to the geom_violin layer; this modified geom_violin has additional options "direction" and "push".

jitterParams

(optional) list of graphic directives that are sent to the geom_jitter layer

pointParams

(optional) list of graphic directives that are sent to the geom_point layer

errorbarParams

(optional) list of graphic directives that are sent to the geom_superberrorbar layer

facetParams

(optional) list of graphic directives that are sent to the facet_grid layer

xAsFactor

(optional) Boolean to indicate if the factor on the horizontal should continuous or discrete (default is discrete)

Value

a ggplot object

References

\insertAllCited

Examples

# This will make a plot with raincloud; they are better seen rotated: +coord_flip()
superbPlot(ToothGrowth, 
   BSFactors = c("dose","supp"), variables = "len",
   plotStyle="raincloud" 
)

# if you extract the data with superbData, you can 
# run this layout directly
#processedData <- superbData(ToothGrowth, 
#   BSFactors = c("dose","supp"), variables = "len"
#)
#
#superbPlot.raincloud(processedData$summaryStatistic,
#   "dose",
#   "supp",
#   ".~.",
#   processedData$rawData)


superb documentation built on Sept. 11, 2024, 8:10 p.m.