Skip to contents

Get information about a ggproto method on error

Usage

ggtrace_inspect_on_error(x, method, ...)

inspect_on_error(x, method, ...)

Arguments

x

A ggplot object

method

A function or a ggproto method. The ggproto method may be specified using any of the following forms:

  • ggproto$method

  • namespace::ggproto$method

  • namespace:::ggproto$method

...

Unused.

Value

A list of three elements: counter, args, and env.

Examples

library(ggplot2)
erroring_barplot <- ggplot(mtcars, aes(mpg, hp)) +
  stat_summary() +
  geom_bar()
ggtrace_inspect_on_error(erroring_barplot, StatCount$setup_params)
#> No summary function supplied, defaulting to `mean_se()`
#> $counter
#> [1] 1
#> 
#> $args
#> $args$self
#> <ggproto object: Class StatCount, Stat, gg>
#>     aesthetics: function
#>     compute_group: function
#>     compute_layer: function
#>     compute_panel: function
#>     default_aes: uneval
#>     dropped_aes: weight
#>     extra_params: na.rm orientation
#>     finish_layer: function
#>     non_missing_aes: 
#>     optional_aes: 
#>     parameters: function
#>     required_aes: x|y
#>     retransform: TRUE
#>     setup_data: function
#>     setup_params: function
#>     super:  <ggproto object: Class Stat, gg>
#> 
#> $args$data
#>       x   y PANEL group
#> 1  21.0 110     1    -1
#> 2  21.0 110     1    -1
#> 3  22.8  93     1    -1
#> 4  21.4 110     1    -1
#> 5  18.7 175     1    -1
#> 6  18.1 105     1    -1
#> 7  14.3 245     1    -1
#> 8  24.4  62     1    -1
#> 9  22.8  95     1    -1
#> 10 19.2 123     1    -1
#> 11 17.8 123     1    -1
#> 12 16.4 180     1    -1
#> 13 17.3 180     1    -1
#> 14 15.2 180     1    -1
#> 15 10.4 205     1    -1
#> 16 10.4 215     1    -1
#> 17 14.7 230     1    -1
#> 18 32.4  66     1    -1
#> 19 30.4  52     1    -1
#> 20 33.9  65     1    -1
#> 21 21.5  97     1    -1
#> 22 15.5 150     1    -1
#> 23 15.2 150     1    -1
#> 24 13.3 245     1    -1
#> 25 19.2 175     1    -1
#> 26 27.3  66     1    -1
#> 27 26.0  91     1    -1
#> 28 30.4 113     1    -1
#> 29 15.8 264     1    -1
#> 30 19.7 175     1    -1
#> 31 15.0 335     1    -1
#> 32 21.4 109     1    -1
#> 
#> $args$params
#> $args$params$width
#> NULL
#> 
#> $args$params$na.rm
#> [1] FALSE
#> 
#> $args$params$orientation
#> [1] NA
#> 
#> 
#> 
#> $env
#> <environment: 0x000002973857c468>
#> 
ggtrace_inspect_on_error(erroring_barplot, ggplot2:::Layer$compute_statistic)
#> No summary function supplied, defaulting to `mean_se()`
#> $counter
#> [1] 2
#> 
#> $args
#> $args$self
#> geom_bar: just = 0.5, width = NULL, na.rm = FALSE, orientation = NA
#> stat_count: width = NULL, na.rm = FALSE, orientation = NA
#> position_stack 
#> 
#> $args$data
#>       x   y PANEL group
#> 1  21.0 110     1    -1
#> 2  21.0 110     1    -1
#> 3  22.8  93     1    -1
#> 4  21.4 110     1    -1
#> 5  18.7 175     1    -1
#> 6  18.1 105     1    -1
#> 7  14.3 245     1    -1
#> 8  24.4  62     1    -1
#> 9  22.8  95     1    -1
#> 10 19.2 123     1    -1
#> 11 17.8 123     1    -1
#> 12 16.4 180     1    -1
#> 13 17.3 180     1    -1
#> 14 15.2 180     1    -1
#> 15 10.4 205     1    -1
#> 16 10.4 215     1    -1
#> 17 14.7 230     1    -1
#> 18 32.4  66     1    -1
#> 19 30.4  52     1    -1
#> 20 33.9  65     1    -1
#> 21 21.5  97     1    -1
#> 22 15.5 150     1    -1
#> 23 15.2 150     1    -1
#> 24 13.3 245     1    -1
#> 25 19.2 175     1    -1
#> 26 27.3  66     1    -1
#> 27 26.0  91     1    -1
#> 28 30.4 113     1    -1
#> 29 15.8 264     1    -1
#> 30 19.7 175     1    -1
#> 31 15.0 335     1    -1
#> 32 21.4 109     1    -1
#> 
#> $args$layout
#> <ggproto object: Class Layout, gg>
#>     coord: <ggproto object: Class CoordCartesian, Coord, gg>
#>         aspect: function
#>         backtransform_range: function
#>         clip: on
#>         default: TRUE
#>         distance: function
#>         expand: TRUE
#>         is_free: function
#>         is_linear: function
#>         labels: function
#>         limits: list
#>         modify_scales: function
#>         range: function
#>         render_axis_h: function
#>         render_axis_v: function
#>         render_bg: function
#>         render_fg: function
#>         setup_data: function
#>         setup_layout: function
#>         setup_panel_guides: function
#>         setup_panel_params: function
#>         setup_params: function
#>         train_panel_guides: function
#>         transform: function
#>         super:  <ggproto object: Class CoordCartesian, Coord, gg>
#>     coord_params: list
#>     facet: <ggproto object: Class FacetNull, Facet, gg>
#>         compute_layout: function
#>         draw_back: function
#>         draw_front: function
#>         draw_labels: function
#>         draw_panels: function
#>         finish_data: function
#>         init_scales: function
#>         map_data: function
#>         params: list
#>         setup_data: function
#>         setup_params: function
#>         shrink: TRUE
#>         train_scales: function
#>         vars: function
#>         super:  <ggproto object: Class FacetNull, Facet, gg>
#>     facet_params: list
#>     finish_data: function
#>     get_scales: function
#>     layout: data.frame
#>     map_position: function
#>     panel_params: NULL
#>     panel_scales_x: list
#>     panel_scales_y: list
#>     render: function
#>     render_labels: function
#>     reset_scales: function
#>     resolve_label: function
#>     setup: function
#>     setup_panel_guides: function
#>     setup_panel_params: function
#>     train_position: function
#>     super:  <ggproto object: Class Layout, gg>
#> 
#> 
#> $env
#> <environment: 0x000002973bc2f6b8>
#>