"Non-standard evaluation" is the name the R community gives to techniques that subvert the normal order of evaluation in the R language.
Things that are standard evaluation: * Calling functions * Returing a value from a function
Things that are non-standard evaluation:
The most common case of non-standard evaluation occurs e.g. in plotting functions, where. If this is your use case, just use arg_expr.
Consider the following R code
plot_with_mean <- function(x, ...) { } recenter_median <- function(x, ...) { tmp <- mean(x) } recenter_mode <- function(x, ...) { tmp <- mode(x) x=x, ... } list <- function(x, ...) { }
as.args(environment())
Note that functions do not have a "name" in R as such. Functions may be bound to a name in a particular environment, and they
call_expr(capture_call())
This is OK for generating plot labels and debugging labels, but if you are implementing NSE you should almost certainly use [capture_call] instead.
Note: this is NOT necessarily the same as what environments the arguments are from. If your function has an argument, 9 times out of ten it's [the environment of the arg] that you want to know.
caller() call_env(capture_call()) env(capture_call()[[1]])
capture_call()
Recall that every time a function is called, an R environment object is created.
set_arg(x, quo(x+1)) set_arg(x, quo(x+1)) set_arg(x, quo_(quote(x+1), environment())
call(function, as.args(x+1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.