statBoxPlotSingle: creates a ggplot object showing a boxplot

View source: R/generalStat.R

statBoxPlotSingleR Documentation

creates a ggplot object showing a boxplot

Description

creates a ggplot object showing a boxplot

Usage

statBoxPlotSingle(
  data,
  column = 1,
  removeNA = TRUE,
  sampleSize = NA,
  outlineColor = "black",
  fillColor = "red",
  jitter = 0.05,
  alpha = 0.5,
  size = 3,
  shape = 16,
  whiskerWidth = 0.5,
  boxWidth = 0.5,
  xAxis = FALSE,
  yAxis = TRUE,
  yLabel = ifelse(!is.Class(data, "data.frame"), NA, ifelse(is.character(column),
    paste(column, collapse = ""), paste(colnames(data)[column], collapse = ", "))),
  title = NA,
  vertical = FALSE,
  xDefault = FALSE,
  xLimits = c(-0.75, 0.75),
  yDefault = TRUE,
  yLimits = c(0, NA),
  showMean = TRUE,
  meanShape = 23,
  meanColor = "black",
  meanFill = "orange",
  meanSize = 5,
  ...
)

Arguments

data

the data to be plotted, can be a numeric/character/etc vector or data.frame like (or tibble etc). If it is data.frame or similar the column argument defines which column is to be used

column

defines which column is to be used for the boxplot. Can be integer or character (column name), note that if both (character) column and yLabel are defined, column is used as label for the Y-axis

removeNA

if TRUE, the NA 'values' in the vector will be removed prior to plotting. @note this will remove warning messages and errors

sampleSize

allows to the use of a sample of the data to be used for the boxplot. By default sampleSize = NA, in which case all data is used

outlineColor

defines the color of the line around the box

fillColor

defines the color of the box itself

jitter

if NA, then the data points will not be shown (only outliers!), otherwise it adds a random value to the x-values of the data points plotted. Note: If set to 0 then they will be located on a straight line

alpha

alpha ('see through' value) of the data points

size

size of the data points

shape

shape of the datapoints (default = 16), see vignette ggplot2::ggplot2-specs

whiskerWidth

defines the width of the whiskers (0-1)

boxWidth

defines the width of the box (0-1)

xAxis

defines if the x-axis is shown

yAxis

defines if the x-axis is shown

yLabel

set y-axis title

title

sets title of graph

vertical

if TRUE, flips x- and y-axis

xDefault

default is set to FALSE, together with xLimits this can be used to tweak the positioning and with of the box

xLimits

default = c(-0.75,0.75), together with xDefault this can be used to tweak the positioning and with of the box

yDefault

default is set to TRUE, together with yLimits, this can be used to define the exact range of the Y-axis

yLimits

default = c(0,NA), together with yLimits, this can be used to define the exact range of the Y-axis

showMean

defines if the mean value of the data should be shown

meanShape

shape of the mean symbol (default = 23)

meanColor

color of the line around the mean symbol

meanFill

fill color of the shape of the mean symbol

meanSize

size of the mean symbol

...

can be used to pass on other arguments to graphAdjust() (like xLimits, xExpand, etc)

Value

a ggplot object

Note

box itself: bottom = 25 lower whisker = 25 upper whisker= 75 IQR = (75


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.