Learn R Programming

walrus (version 1.0.5)

rplots: Box & Violin Plots

Description

Box & Violin Plots

Usage

rplots(
  data,
  vars,
  splitBy = NULL,
  violin = TRUE,
  boxplot = FALSE,
  dot = TRUE,
  dotType = "stack"
)

Value

A results object containing:

results$plotsan array of images

Arguments

data

the data as a data frame

vars

a vector of strings naming the variables in data of interest

splitBy

a string naming the variable in data to split the data by

violin

TRUE (default) or FALSE, provide violin plots

boxplot

TRUE or FALSE (default), provide box plots

dot

TRUE (default) or FALSE, plot each measurement as a dot

dotType

'jitter' or 'stack' (default); whether data dots are jittered or stacked

Examples

Run this code
data('eurosoccer', package='WRS2')

# violin plots

walrus::rplots(
    data = eurosoccer,
    vars = "GoalsGame",
    splitBy = "League")


# box plots

walrus::rplots(
    data = eurosoccer,
    vars = "GoalsGame",
    splitBy = "League",
    violin = FALSE,
    boxplot = TRUE,
    dot = FALSE)

Run the code above in your browser using DataLab