grapes-L-plus-grapes: Add components to a ggloop object.

Description Usage Arguments Details Examples

Description

The %L+% (L-plus) operator allows you to add components to a ggloop object - whether that object is a:

Usage

1
lhs %L+% rhs

Arguments

lhs

Typically the returned object by ggloop(): either a nested list of ggplot objects or a list of ggplot object, but can also be a single ggplot object.

rhs

A geom, stat, or other layer feature from the ggplot2 package.

Details

%L+% is a substitute for + and is used in the same fashion: to add geoms, stats, aesthetics, facets, and other features to ggplot object. The returned object from ggloop() is often a nested list of ggplot objects. However it is possible to use %L+% in place of where + would normally be used. This is due to the conditional statements present in %L+%'s structure.

Examples

1
2
3
4
5
6
7
8
9
# Add component to entire list.
g <- ggloop(mtcars, aes_loop(x = mpg:hp, y = mpg:hp))
g <- g %L+% ggplot2::geom_point()

# Add component to a subset of a list
g2 <- ggloop(mtcars, aes_loop(x = disp:wt, y = disp:wt, color = c(cyl, gear)))
g2$color.gear <- g2$color.gear %L+% ggplot2::geom_point()
g2$color.cyl[1:3] <- g2$color.cyl[1:3] %L+% ggplot2::geom_point()
g2$color.cyl$x.hp_y.drat <- g2$color.cyl$x.hp_y.drat %L+% ggplot2::geom_point()

ggloop documentation built on May 2, 2019, 3:01 a.m.