Skip to contents

Inject parameter tracer into one function


inject_tracer(f, trace_lists = FALSE)



A function (that is, an object of class "function", and not a character string).


If TRUE, trace into any nested list parameters (including data.frame-type objects), and return type information on each list component. The parameter names for these list-components are then specified in "dollar-notation", for example 'Orange$age'.


Nothing (will error on fail).


The tracer is defined in the internal typetracer_header() function. This uses an options variable defined on package load for the current tempdir, defining a single location where all traced values are dumped. This is done via options to allow both multi-threaded function calls and calls via callr to be traced.


f <- function (x, y, z, ...) {
    x * x + y * y
inject_tracer (f)
val <- f (1:2, 3:4 + 0., a = "blah")
x <- load_traces ()

# Traces should always be "uninjected":
uninject_tracer (f)
#> [1] TRUE
# Traces may also be removed:
clear_traces ()