react: Reactivity helper

reactR Documentation

Reactivity helper

Description

The react object gives alternative syntax to call shiny reactive expressions.

Usage

react

Format

An object of class react of length 0.

Details

The benefit is that it makes them easier to spot in your code.

Examples

# This works by invoking the function from the parent environment
# with no arguments ...
foo <- function() {
  42
}
react$foo
react[foo]
react[foo()]

## Not run: 
  # ... but it only becomes relevant when used in shiny
  # server code, e.g. this app from the shiny page
  # with react$dataInput instead of dataInput()
  server <- function(input, output) {

    dataInput <- reactive({
      getSymbols(input$symb, src = "yahoo",
          from = input$dates[1],
            to = input$dates[2],
            auto.assign = FALSE)
    })

    output$plot <- renderPlot({
       chartSeries(react$dataInput, theme = chartTheme("white"),
              type = "line", log.scale = input$log, TA = NULL)
    })
  }

## End(Not run)

react documentation built on May 29, 2024, 4:36 a.m.