| ExprBuilder {table.express} | R Documentation |
Frame expression builder
Description
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
appendsExtra expressions that go at the end.
exprThe final expression that can be evaluated with
base::eval()orrlang::eval_bare().
Methods
Public methods
Method new()
Constructor.
Usage
ExprBuilder$new(
DT,
dt_pronouns = list(),
nested = list(),
verbose = getOption("table.express.verbose", FALSE)
)Arguments
DTdt_pronouns, nestedInternal parameters for joins.
verbosePrint 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
valueA captured expression.
chain_if_neededWhether 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
valueA captured expression.
chain_if_neededWhether chaining is allowed during this step.
Method set_by()
Set the by clause expression.
Usage
ExprBuilder$set_by(value, chain_if_needed)
Arguments
valueA captured expression.
chain_if_neededWhether 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
typeOne of "frame", "pronoun".
next_dtNext data table when chaining pronoun.
parent_envWhere to evaluate current expression when chaining pronoun.
to_eagerWhether 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
.exprsList 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_envEnclosing environment.
by_refFlag 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_exprThe 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
deepWhether to make a deep clone.