Learn R Programming

xkcd (version 0.0.3)

createdefaultmappinganddata: Creates a canonical mapping and its associated data base

Description

This function transforms the mapping and the data base to get a canonical mapping where the aesthetic variables are equal to the names of the data base.

Usage

createdefaultmappinganddata(mapping, data, mandatoryarguments=c("x","y"))

Arguments

mapping
Set of aesthetics.
data
Default data frame. It is expected that all layers are included in the data set.
mandatoryarguments
Arguments that must appear in the mapping

Value

  • A list with a mapping of aesthetics and a data frame.

Details

It creates an aesthetic layer with the default names. If it is necessary, it changes the names of the data base.

See Also

aes_string

Examples

Run this code
data <- data.frame(x1=1,y1=2)
mapping <- aes(x = x1 + y1, y = y1) # default names: x and y
mapping
## List of 2
##  $ x: language x1 + y1
##  $ y: symbol y1

createdefaultmappinganddata(mapping,data)
## $mapping
## List of 2
##  $ x: symbol x
##  $ y: symbol y

## $data
##   x y x1 y1
## 1 3 2  1  2

Run the code above in your browser using DataLab