Annotating R functions to trace their execution
rm(list = ls())
library("devtools")
install_github("agalecki/traceR")
library (traceR)
(fx <- function(x) x+2)
traceR:::traceReditor(fx)
(fx <- function(x) x^2)
annotate_fun(fx) # fx annotated
annotate_fun(fx, flbl = "our_label")
annotate_fun(round) # Body is null. Annotation not made. Error message.
annotate_fun(testthat:::as.expectation.expectation) )
sessionInfo()
ls(asNamespace("stringr")) # namespace for stringr package
stringr:::word # Body of the function
library(traceR)
library(stringr)
traceRedit(ns = "stringr")
detach(package:stringr)
stringr:::word # Annotated function
library(stringr)
sentences <- c("Jane saw a cat", "Jane sat down")
traceR.on() # options()$traceR
word(sentences, 1)
head(.traceRmap)
dim(.traceRmap)
traceR.report() # html map (dynamic tree) created
Objects() # List of environments: e_1, ...
ls(e_1) # Names of objects in environment
e_1$start # Object in environment
e_1$string
traceR.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.