Build an expression that will be used inside a data.table::data.table's frame. This shouldn't be used directly.

Value

In general, a modified self with extended expression.

Active bindings

appends

Extra expressions that go at the end.

expr

The final expression that can be evaluated with base::eval() or rlang::eval_bare().

Methods


Method new()

Constructor.

Usage

ExprBuilder$new(
  DT,
  dt_pronouns = list(),
  nested = list(),
  verbose = getOption("table.express.verbose", FALSE)
)

Arguments

DT

A data.table::data.table.

dt_pronouns, nested

Internal parameters for joins.

verbose

Print more information during the process of building expressions.


Method set_i()

Set the i clause expression(s), starting a new frame if the current one already has said expression set.

Usage

ExprBuilder$set_i(value, chain_if_needed)

Arguments

value

A captured expression.

chain_if_needed

Whether chaining is allowed during this step.


Method set_j()

Like set_i but for the j clause.

Usage

ExprBuilder$set_j(value, chain_if_needed)

Arguments

value

A captured expression.

chain_if_needed

Whether chaining is allowed during this step.


Method set_by()

Set the by clause expression.

Usage

ExprBuilder$set_by(value, chain_if_needed)

Arguments

value

A captured expression.

chain_if_needed

Whether chaining is allowed during this step.


Method chain()

By default, start a new expression with the current one as its parent. If type = "pronoun", dt is used to start a new expression that joins the current one.

Usage

ExprBuilder$chain(type = "frame", next_dt, parent_env, to_eager = FALSE)

Arguments

type

One of "frame", "pronoun".

next_dt

Next data table when chaining pronoun.

parent_env

Where to evaluate current expression when chaining pronoun.

to_eager

Whether or not to use an EagerExprBuilder in the new chain


Method chain_if_set()

Chain if any clause values are already set.

Usage

ExprBuilder$chain_if_set(...)

Arguments

...

Clause values.


Method seek_and_nestroy()

Helper for nest_expr.

Usage

ExprBuilder$seek_and_nestroy(.exprs)

Arguments

.exprs

List of expressions.


Method eval()

Evaluate the final expression with parent_env as the enclosing environment. If by_ref = FALSE, data.table::copy() is called before. The ellipsis' contents are assigned to the expression's evaluation environment.

Usage

ExprBuilder$eval(parent_env, by_ref, ...)

Arguments

parent_env

Enclosing environment.

by_ref

Flag to control deep copies.

...

Additional variables for the evaluation environment.


Method tidy_select()

Evaluate a tidyselect call using the currently captured table.

Usage

ExprBuilder$tidy_select(select_expr)

Arguments

select_expr

The selection expression.


Method print()

Prints the built expr.

Usage

ExprBuilder$print(...)

Arguments

...

Ignored.


Method clone()

The objects of this class are cloneable with this method.

Usage

ExprBuilder$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.