Learn R Programming

g2r (version 0.1.0)

fig_errorbar: Error bar

Description

Add error bars based y, ymin, ymax, and optionally group aspects.

Usage

fig_errorbar(g2, ..., line_size = 1, tip_size = 5, data = NULL,
  inherit_asp = TRUE, name = NULL)

Arguments

g2

An object of class g2r as returned by g2r.

...

Any option, aesthetic (asp), or animation (Animation).

line_size, tip_size

Defines size of error bars.

data

A data.frame containing data to chart or a list.

inherit_asp

Whether to inherit aspects from g2r.

name

Name of figure, useful to apply functions to specific figures.

Examples

Run this code
# NOT RUN {
df <- data.frame(
  trt = factor(c(1, 1, 2, 2)),
  resp = c(1, 5, 3, 4),
  group = factor(c(1, 2, 1, 2)),
  upper = c(1.1, 5.3, 3.3, 4.2),
  lower = c(0.8, 4.6, 2.4, 3.6)
)

g2(df, asp(trt, ymin = lower, ymax = upper, color = group)) %>% 
  fig_errorbar()

# }

Run the code above in your browser using DataLab