Add a new expression to a list (of expressions).
Details
Offers a stricter control to add new expressions to an existing
list. The list of expressions can be later used to generate a pipeline,
for instance with pipe_expr
.
Examples
library(rtables)
lyt <- list()
lyt <- add_expr(lyt, substitute(basic_table()))
lyt <- add_expr(
lyt, substitute(split_cols_by(var = arm), env = list(armcd = "ARMCD"))
)
lyt <- add_expr(
lyt,
substitute(
test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strata")
)
)
)
lyt <- add_expr(lyt, quote(build_table(df = dta)))
pipe_expr(lyt)
#> basic_table() %>% split_cols_by(var = arm) %>% test_proportion_diff(vars = "rsp",
#> method = "cmh", variables = list(strata = "strata")) %>%
#> build_table(df = dta)