expr_pipe: Return a list of expressions all piped together as a single...

View source: R/universal_useful.R

expr_pipeR Documentation

Return a list of expressions all piped together as a single expression

Description

Useful when making complex compound statements that require dynamic substitution via tidy eval for dynamically created variables derived from the context.

Usage

expr_pipe(exprs)

Arguments

exprs

expressions See exprs

Value

expression

Examples

(.data <- tibble::tibble(val = runif(10)))
(exp <- expr_pipe(
  rlang::exprs(
    .data,
    dplyr::mutate(val = val + 5, category = sample(1:3, length(val), replace = TRUE)),
    dplyr::group_by(category),
    dplyr::summarise(s = sum(val))
  )
))
rlang::eval_bare(exp)

yogat3ch/UU documentation built on May 31, 2024, 10:14 p.m.