Skip to contents

Coerces ggplot mappings to 'data.frame'.

Usage

# S3 method for class 'ggplot'
mapframe(x, ...)

Arguments

x

ggplot

...

ignored

Value

data.frame

Details

* 'aesthetic' captures each aesthetic label as a string. * 'map' captures each map (typ. a column name) as a string. * 'layer' is zero for the default mapping, else the layer number. * 'data' is NA for default data if missing. Else zero for x$data, zero for layers with no data, and layer number for layers with data.

Examples

library(ggplot2)
mapframe(ggplot(mapping = aes(conc, time, shape = factor(dose))))
#>   aesthetic          map layer data
#> 1         x         conc     0   NA
#> 2         y         time     0   NA
#> 3     shape factor(dose)     0   NA