Interact with internal whereami counter

counter_state(item = NULL, tag = NULL)

counter_reset(item = NULL, tag = NULL)

counter_names()

counter_tags()

counter_get()

Arguments

item

character, name of the counter to access, Default: NULL

tag

character, tag of the counter to acces, if it was set at initial whereami call. This can be used instead of the item name, Default: NULL

Details

counter_names() returns names of the active stored counters.

counter_state() returns current hit count for item, if NULL then all counters are returned.

counter_reset() will remove counter of item, if item is NULL then all counters are reset.

counter_get() returns a table with all the counters. These can then be plotted with the with the plot method.

A json log of the counter is written to file.path(tempdir(),'whereami.json') by default The path can be set using set_whereami_log

See also

Other counter: set_whereami_log()

Author

Jonathan Sidi

Examples


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)

}