Skip to contents

collect() on a tbl_lazy_json returns a promises::promise(), because the result is fetched asynchronously from the browser. These operators from the promises package are re-exported so you can consume that result inside shiny::observeEvent() / shiny::observe() without attaching promises yourself.

Usage

lhs %...>% rhs

lhs %...!% rhs

lhs %...T>% rhs

Arguments

lhs

A promise (e.g. the value returned by collect()).

rhs

A function call or expression applied to the resolved value.

Value

A promises::promise(). %...>% resolves with the value of rhs applied to the fulfilled value; %...!% handles a rejected promise; and %...T>% (tee) applies rhs for its side effects and resolves with the original fulfilled value. See promises::pipes.

Examples

if (interactive()) {
  shiny::observeEvent(input$compute, {
    lazy_data() |>
      dplyr::filter(mpg >= input$min_mpg) |>
      dplyr::collect() %...>% {
        # `.` is the collected tibble
        print(.)
      }
  })
}