Skip to content

ggtrace 0.5.0

Compare
Choose a tag to compare
@yjunechoe yjunechoe released this 13 Mar 05:24

New Features

  • Added complements to the base::debug() family of functions that are compatible with ggproto methods - ggdebug(), ggdebugonce(), ggundebug()

  • get_method_inheritance() to get the list of methods from self and parent ggprotos

  • ggtrace_inspect_n() to get the number of times a method was called in the evaluation of a ggplot

  • ggtrace_inspect_which() to get the indices when a condition cond evaluated to true inside a method

  • ggtrace_inspect_vars() to get the value of variables at specified steps of a method's execution

  • ggtrace_inspect_args() to get the value of arguments passed to a method

  • ggtrace_highjack_args() to modify formals of a method at its execution

  • with_ggtrace() gets a out argument which can take 1 of three options:

    • "t" or "tracedump" (default): returns the local tracedump from triggering traces on the method as the ggplot x is evaluated
    • "g" or "gtable": Invisibly returns the <gtable> grob after evaluating x with injected expressions in method.
    • "b" or "both": returns the tracedump while rendering the gtable (with grid::grid.draw()) as a side effect.
  • Low-level functions ggtrace()/gguntrace() and wrapper with_ggtrace() can now take quosures in the method argument, which allows them to be used more programmatically.

Breaking Changes

  • ggtrace_capture_env() default value of at is changed to -1L, which captures a snapshot of the runtime environment right before the method returns. Only the first element is used if at is length > 1
  • "modify" workflows are renamed to "highjack" (starting with ggtrace_highjack_return()) to reflect the fact that they always return the graphical output (gtable grob) (#78)

Bug Fixes

  • Fixed an issue where a trace would fail to remove itself with ggtrace(once = TRUE) if it was triggered by a copy of the traced function (#59)