inside: Evaluate a List of Expressions in a Data Environment

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Do lazy evaluation on a named list of quoted R expressions in an environment constructed from data, modifying the original data.

Usage

1

Arguments

data

A data.frame or list.

exprlist

A named list of quoted expressions.

...

Ignored.

Details

This is a dialect of the base function within. Like the base function, inside evaluates the expression(s) passed to it in a special environment constructed from data and returns the data, modified with the evaluated expressions.

But whereas the base function is passed an expression, exprlist is a named list of quoted expressions. Each expression in the list is evaluated, assigned to its corresponding name, and included in the return.

Evaluation starts with the first member of exprlist, then the second, and so on. If an expression A is evaluated and A contains the name of another expression B, B is evaluated before A. Therefore, the members of exprlist may contain references to each other and exprlist may be ordered in any way. This is accomplished by evaluating the expressions via promises, and this evaluation framework is the main advantage of using inside over the base function within.

The parent environment is that of the caller.

Value

A list or a data.frame containing data and the evaluated members of exprlist.

Author(s)

Robert Sams robert@sanctumfi.com

See Also

Class "expr.frame" and within (base package).

Examples

1
head(inside(spx, list(Ln=quote(log(RoR)), RoR=quote(ror(Close, 1, delta=.001)))))

tradesys documentation built on May 2, 2019, 4:53 p.m.