nseval (version 0.4)

do: Making function calls, with full control of argument scope.

Description

The functions do and do_ construct and invoke a function call. In combination with dots and quotation objects they allow you to control the scope of the function call and each of its arguments independently.

Usage

do(...)

do_(...)

Arguments

...

All arguments are concatenated using c.dots(). The first element of the resulting list is taken as a function to call, the rest as its arguments.

Value

The return value of the call.

Details

For do_ all arguments should be quotation or dots objects, or convertible to such using as.quo(). They will be concatenated together by c.dots to form the call list (a dots object). For do the first argument is quoted literally, but the rest of the arguments are evaluated the same way as do_.

The first element of the call list represents the function, and it should evaluate to a function object. The rest of the call list is used as that function's arguments.

When a quotation is used as the first element, the call is evaluated from the environment given in that quotation. This means that calls to caller() (or parent.frame()) from within that function should return that environment.

do is intended to be a replacement for base function do.call.

See Also

get_call do.call match.call