if(interactive()){
txt <- "
whereami::cat_where(whereami::whereami(tag = 'tag1'))
"
tf <- tempfile(fileext = '.R')
cat(txt,file = tf)
source(tf)
counter_state()
counter_state(tag = 'tag1')
counter_names()
counter_tags()
counters <- counter_get()
counters
plot(counter_get())
# read the json log
jsonlite::read_json(
file.path(tempdir(),'whereami.json'),
simplifyVector = TRUE)
# clear all counters
counter_reset()
#verify that there are no active counters
counter_state()
# cleanup
unlink(tf)
}
Run the code above in your browser using DataLab