ggbarmaker: Easy Bar Graph Maker for ggplot2

ggbarmakerR Documentation

Easy Bar Graph Maker for ggplot2

Description

Makes quick and easy bar graphs for ggplot2 without pre-summarizing.

Usage

ggbarmaker(
  dv,
  groups,
  factor = NULL,
  id = NULL,
  groups_between = FALSE,
  palette = "Set1"
)

Arguments

dv

Dependent variable vector

groups

Groups or first factor variable.

factor

Second factor variable.

id

The name of a varible that identifieseach subject for withins-subject designs.

groups_between

The 'groups' variable is a between subjects factor.

palette

Select RColorBrewer palette.

Note

You must manually adjust y-axis range using the ggplot2 function coord_cartesian().

Author(s)

Robert S. Chavez

Examples

# Between subject design.
x <- rnorm(100,100,15)
y <- sample(c("Group 1","Group 2"),100,TRUE)
z <- sample(c("Low","Med","High"),100,TRUE)
# Only one factor.
ggbarmaker(x,y)

# Two factors.
ggbar.maker(x,y,z)



# Within subject design
x <- rnorm(100,100,15)
y <- sample(c("Group 1","Group 2"),100,TRUE)
z <- sample(c("Low","Med","High"),100,TRUE)
subject <- rep(1:5,20)

# No between subjects factors.
ggbarmaker(x,y,z, id =subject)

# Grouping factor is between subjects.
ggbarmaker(x,y,z, id =subject, groups_between=TRUE)

chavezlab/csnl documentation built on June 12, 2022, 10:09 a.m.