react | R Documentation |
The react
object gives alternative syntax to call
shiny reactive expressions.
react
An object of class react
of length 0.
The benefit is that it makes them easier to spot in your code.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.