I am trying run 'R language' in then parent.frame environment.
The R base method works using eval() and parse() and assign().
I can not find an rlang way using eval_tidy(), parse_quo() and assign().
What else to I need to do?
Thanks,
Andre
innerf <- function() {
require(rlang)
# rlang
# action <- parse_expr("assign(\"envr\", environment())")
# action <- parse_quo("assign(\"envr\", environment())", env = parent.frame())
action <- parse_quo("assign(\"envr\", environment())", env = env_parent())
# does not work # quosures: env is ignored
eval_tidy(quo(!!action))
# base R
eval(parse(text="assign(\"envo\", environment())"), envir = parent.frame())
}
outerf <- function() {
innerf()
print(ls())
}