whence_value() gives the value that the pipeline made.
whence_code() gives code that makes the value again.
Usage
whence_value(trace)
whence_code(trace)
Value
whence_value() gives a vector of length one. whence_code()
gives a single string.
Details
In the code, input$name and input[["name"]] are replaced by their
values at the time of the trace. Nothing else is replaced: each other
name is written as it is in the pipeline. A wider rule could replace a
name that a verb reads as a column, and give wrong code.
Examples
library(dplyr, warn.conflicts = FALSE)
input <- list(cyl = 6)
trace <- whence_trace(
mtcars |>
filter(cyl == input$cyl) |>
summarise(n = n())
)
whence_value(trace)
#> [1] 7
cat(whence_code(trace))
#> mtcars |>
#> filter(cyl == 6) |>
#> summarise(n = n())