c_transform: Utilities for transforming data frames with convention aware...

Description Usage Arguments Examples

View source: R/ggconventions.r

Description

c_transform replaces or adds series to data frames with convention aware series, c_fortify is a wrapper around c_transform that defaults to adding new series rather than replacing series

Usage

1
2
3
4
c_transform(data, variables = getOption("conventions", NULL),
  fortify_data = FALSE, prefix = "c.")

c_fortify(data, variables = getOption("conventions", NULL), prefix = "c.")

Arguments

data

Data frame

variables

Which variables to transform, if NULL try all of them

fortify_data

If TRUE add new variables with prefix instead of replacing them

prefix

Prefix to use if fortify_data is TRUE.

Examples

1
2
3
4
5
6
7
require("ggplot2")
source(system.file("conventions/gender.R", package="ggconventions"))
data("gender_data", package="ggconventions")
qplot(x=class, y=survivors, colour=gender, shape=gender, 
  data=c_transform(gender_data), geom="blank") + geom_point(size=5)
qplot(x=class, y=survivors, colour=gender, shape=c.gender, 
   data=c_fortify(gender_data), geom="blank") + geom_point(size=5)

trevorld/ggconventions documentation built on May 25, 2019, 9:25 a.m.