From 3e673f7c2c8368cdee7c1c87573e6f5c6b71a86b Mon Sep 17 00:00:00 2001 From: June Choe Date: Mon, 7 Feb 2022 08:59:55 -0500 Subject: [PATCH] bump to 0.4.8 --- DESCRIPTION | 2 +- NEWS.md | 9 +- R/with_ggtrace.R | 2 +- R/workflows-modify.R | 2 +- README.Rmd | 4 +- README.md | 4 +- _pkgdown.yml | 18 ++- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/LICENSE.html | 2 +- docs/articles/FAQ.html | 16 +-- docs/articles/casestudy-after_scale.html | 2 +- docs/articles/casestudy-ggxmean.html | 4 +- docs/articles/comparisons.html | 2 +- docs/articles/index.html | 2 +- docs/articles/intro.html | 2 +- docs/articles/showcase-aes_evaluation.html | 2 +- docs/articles/showcase-ggplot_build.html | 2 +- docs/articles/technical-details.html | 2 +- docs/authors.html | 2 +- docs/index.html | 6 +- docs/news/index.html | 20 +++- docs/pkgdown.yml | 2 +- docs/reference/Rplot001.png | Bin 15456 -> 8451 bytes docs/reference/Rplot002.png | Bin 20599 -> 21799 bytes docs/reference/get_method.html | 4 +- docs/reference/ggdebugonce.html | 2 +- docs/reference/ggedit.html | 2 +- docs/reference/ggeval_silent.html | 4 +- docs/reference/ggtrace.html | 2 +- docs/reference/ggtrace_capture_env.html | 2 +- docs/reference/ggtrace_capture_fn.html | 4 +- docs/reference/ggtrace_inspect_return.html | 128 +++++++++++++++++++++ docs/reference/ggtrace_modify_return.html | 116 +++++++++++++++++++ docs/reference/ggtraceback.html | 2 +- docs/reference/gguntrace.html | 2 +- docs/reference/global_ggtrace.html | 2 +- docs/reference/index.html | 47 +++++++- docs/reference/is_traced.html | 2 +- docs/reference/last_ggtrace.html | 2 +- docs/reference/with_ggtrace.html | 6 +- docs/search.json | 2 +- docs/sitemap.xml | 6 + man/ggtrace_modify_return.Rd | 2 +- man/with_ggtrace.Rd | 2 +- 45 files changed, 384 insertions(+), 66 deletions(-) create mode 100644 docs/reference/ggtrace_inspect_return.html create mode 100644 docs/reference/ggtrace_modify_return.html diff --git a/DESCRIPTION b/DESCRIPTION index 4bd36c1..284b2c4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ggtrace Type: Package Title: Programmatically debug ggproto methods with trace -Version: 0.4.7 +Version: 0.4.8 Authors@R: c( person(given = "June", family = "Choe", diff --git a/NEWS.md b/NEWS.md index 12066ca..31b7fe7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,16 @@ # ggtrace (development version) +# ggtrace 0.4.8 + ### New Features - Added `with_ggtrace()` for a functional interface to `ggtrace()` -- Added `ggtrace_capture_(fn|env)` functions which returns a snapshot of the function/environment of the ggproto method at execution time +- Added `ggtrace_capture_fn()` and `ggtrace_capture_env()`, which return a snapshot of the function/environment of the ggproto method at execution time +- Added `ggtrace_inspect_return()` and `ggtrace_modify_return()` to grab and swap return values at method's execution + +### Miscellaneous + +- Added workflows section to docs/references # ggtrace 0.4.7 diff --git a/R/with_ggtrace.R b/R/with_ggtrace.R index e549e6f..bde2cfb 100644 --- a/R/with_ggtrace.R +++ b/R/with_ggtrace.R @@ -1,4 +1,4 @@ -#' Isolate a ggtrace call for a single ggplot object +#' Apply a ggtrace call to a single ggplot object #' #' `with_ggtrace()` provides a functional interface to `ggtrace()`. It takes a ggplot object #' and parameters passed to `ggtrace()` and returns the immediate tracedump without side effects. diff --git a/R/workflows-modify.R b/R/workflows-modify.R index 79d1033..3471128 100644 --- a/R/workflows-modify.R +++ b/R/workflows-modify.R @@ -6,7 +6,7 @@ #' @param cond When the return value should be replaced #' @param draw Whether to draw the modified plot #' -#' @return A gtable object +#' @return A gtable object with class `` #' @export #' ggtrace_modify_return <- function(x, method, value, cond = TRUE, draw = TRUE) { diff --git a/README.Rmd b/README.Rmd index 2726576..d7fff60 100644 --- a/README.Rmd +++ b/README.Rmd @@ -24,7 +24,7 @@ knitr::opts_chunk$set( # **{ggtrace}** -[![](https://img.shields.io/badge/devel%20version-0.4.7-gogreen.svg)](https://github.com/yjunechoe/ggtrace) +[![](https://img.shields.io/badge/devel%20version-0.4.8-gogreen.svg)](https://github.com/yjunechoe/ggtrace) [![](https://img.shields.io/badge/lifecycle-stable-gogreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing) @@ -63,7 +63,7 @@ remotes::install_github("yjunechoe/ggtrace") ``` ```{r setup} -library(ggtrace) # v0.4.7 +library(ggtrace) # v0.4.8 ``` ## **Example 1 - `compute_layer` method from `PositionJitter`** diff --git a/README.md b/README.md index a89311b..aa3282c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ -[![](https://img.shields.io/badge/devel%20version-0.4.7-gogreen.svg)](https://github.com/yjunechoe/ggtrace) +[![](https://img.shields.io/badge/devel%20version-0.4.8-gogreen.svg)](https://github.com/yjunechoe/ggtrace) [![](https://img.shields.io/badge/lifecycle-stable-gogreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing) @@ -46,7 +46,7 @@ You can install the development version from # install.packages("remotes") remotes::install_github("yjunechoe/ggtrace") - library(ggtrace) # v0.4.7 + library(ggtrace) # v0.4.8 ## **Example 1 - `compute_layer` method from `PositionJitter`** diff --git a/_pkgdown.yml b/_pkgdown.yml index 771d13f..838f661 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -37,17 +37,31 @@ reference: - title: Workflows desc: > These function takes a ggplot object and a ggproto method, tracing and triggering - the method immediately without relying on side-effects + the method immediately without relying on side-effects. Most of these workflow + functions wraps around the lower-level function `with_ggtrace()`, a functional + complement to `ggtrace()` contents: - with_ggtrace +- subtitle: Inspect + desc: > + Inspect values from steps in the method's execution for examination + contents: + - ggtrace_inspect_return + - subtitle: Capture desc: > - Return a snapshot of a ggproto method's execution + Capture a snapshot of a method's execution state for dynamic evaluation contents: - ggtrace_capture_fn - ggtrace_capture_env +- subtitle: Modify + desc: > + Modify the method's behavior as it is executed and return the graphical output + contents: + - ggtrace_modify_return + - title: One-offs desc: Convenient shortcuts to common workflows without side effects contents: diff --git a/docs/404.html b/docs/404.html index 72146b3..54ec90f 100644 --- a/docs/404.html +++ b/docs/404.html @@ -26,7 +26,7 @@ ggtrace - 0.4.7 + 0.4.8 + + + + + +
+
+
+ +
+

Inspect the return value of a method

+
+ +
+

Usage

+
ggtrace_inspect_return(x, method, cond = TRUE)
+
+ +
+

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

  • +
+
cond
+

When the return value should be replaced. Defaults to TRUE. +Given that only one value is returned by ggtrace_inspect_return, the default +value is the return value from the first time the method runs.

+
+
+

Value

+

The return value from method when it is first called.

+
+
+

Details

+

The value to cond can be a quoted expression, which gets evaluated every +time the method is called during the evaluation of x. If cond evaluates to TRUE +multiple times (such as in the default case when cond is simply TRUE), the function +gives the return value from the first time the method runs.

+

The cond expression is evaluated inside the method's current execution environment, with +the addition of a data-masked variable ._counter (or .data$._counter), which internally +tracks the current index of the method. For example, ._counter == 3 targets the third time +the method is called.

+

Additionally, when quoted and passed to cond, the function returnValue() accesses the +current return value of the method. For example, unique(returnValue()$PANEL) == 2 for +Stat$compute_group targets the method when it's processing data for the second PANEL.

+
+ +
+ + +
+ + + + + + + diff --git a/docs/reference/ggtrace_modify_return.html b/docs/reference/ggtrace_modify_return.html new file mode 100644 index 0000000..decad8a --- /dev/null +++ b/docs/reference/ggtrace_modify_return.html @@ -0,0 +1,116 @@ + +Modify the return value of a method — ggtrace_modify_return • ggtrace + Skip to contents + + +
+
+
+ +
+

Modify the return value of a method

+
+ +
+

Usage

+
ggtrace_modify_return(x, method, value, cond = TRUE, draw = TRUE)
+
+ +
+

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

  • +
+
value
+

Value for the method to return when it is called

+
cond
+

When the return value should be replaced

+
draw
+

Whether to draw the modified plot

+
+
+

Value

+

A gtable object with class <ggtrace_modified>

+
+ +
+ + +
+ + + + + + + diff --git a/docs/reference/ggtraceback.html b/docs/reference/ggtraceback.html index 1106719..c12479e 100644 --- a/docs/reference/ggtraceback.html +++ b/docs/reference/ggtraceback.html @@ -10,7 +10,7 @@ ggtrace - 0.4.7 + 0.4.8