bru_eval_in_data_context {inlabru} | R Documentation |
Evaluate expressions in data contexts
Description
Evaluate an expression in a series of data contexts, also making the objects directly available as names surrounded by ".", stopping when the expression evaluation completes with no error.
This is an internal inlabru method, not intended for general use.
Usage
bru_eval_in_data_context(
input,
data = NULL,
default = NULL,
.envir = parent.frame()
)
Arguments
input |
An expression to be evaluated |
data |
list of data objects in priority order. Named elements will
be available as |
default |
Value used if the expression is evaluated as NULL. Default NULL |
.envir |
The evaluation environment |
Value
The result of expression evaluation
Examples
# The A values come from the 'data' element, and the B values come from
# the 'response_data' element, as that is listed first.
bru_eval_in_data_context(
quote(
list(A = .data.$x, B = x)
),
list(
response_data = tibble::tibble(x = 1:5),
data = tibble::tibble(x = 1:10)
)
)
# Both A and B come from the 'data' element, as 'x' is found there,
# terminating the evaluation attempt.
bru_eval_in_data_context(
quote(
list(A = .data.$x, B = x)
),
list(
data = tibble::tibble(x = 1:10),
response_data = tibble::tibble(x = 1:5)
)
)