buildNameCallback | R Documentation |
Build a custom writeback function that writes state into a user named variable.
buildNameCallback(varName)
varName |
character where to write captured state |
writeback function for use with functions such as DebugFnW
# user function
f <- function(i) { (1:10)[[i]] }
# capture last error in variable called "lastError"
writeBack <- buildNameCallback('lastError')
# wrap function with writeBack
df <- DebugFnW(writeBack,f)
# capture error (Note: tryCatch not needed for user code!)
tryCatch(
df(12),
error = function(e) { print(e) })
# examine error
str(lastError)
# redo call, perhaps debugging
tryCatch(
do.call(lastError$fn_name, lastError$args),
error = function(e) { print(e) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.