library(rlang)
# Passing fn() evaluation frame to g():
fn <- function(early = F) {
fn_env <- current_env()
if(early)
g(fn_env)
stop("expected return prior here (fn) in call to (g)")
}
g <- function(env){
return_from(env, "sig-g: return early from fn")
stop("expected return from 1st (fn) in call to next (h)")
}
# Here we return from fn() with a new return value:
h <- function(env){
return_from(env, "sig-h: return early from fn")
stop("expected return from 1st (fn) in prior eval from here")
}
fn()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.