tracing: tracing tag

Description Usage Arguments Details Examples

Description

Emulates the behavior of base::trace.

Usage

1
tracing(.tracer = NULL, .exit = NULL, .at = 1, .edit = FALSE)

Arguments

.tracer

either a function or an unevaluated expression. The function will be called or the expression will be evaluated either at the beginning of the call, or before those steps in the call specified by the argument at.

.exit

either a function or an unevaluated expression. The function will be called or the expression will be evaluated on exiting the function.

.at

optional numeric vector or list. If supplied, .tracer will be called just before the corresponding step in the body of the function.

.edit

For complicated tracing, such as tracing within a loop inside the function, you will need to insert the desired calls by editing the body of the function. If so, supply the edit argument either as TRUE, or as the name of the editor you want to use. Then tracing() will call edit and use the version of the function after you edit it.

Details

It's not a wrapper around base::trace, instead it modifies the body of the input function. If the input function is an S3 generic the effect of the tracing can be overwritten by the argument values, better in this case to use the relevant method as a function input.

Examples

1
tracing(quote(print("hello")), .exit = quote(print("good bye")))$mean(1:5)

moodymudskipper/tags documentation built on June 25, 2019, 10:54 a.m.