Files
shiny/inst/rmd-examples/reactive.Rmd
2014-03-31 16:40:17 -07:00

27 lines
432 B
Plaintext

# Reactive document 1
Here's some inputs
```{r}
div(
selectInput("dataset", "Dataset", c("cars", "iris", "mtcars")),
numericInput("rows", "Rows to show", 5)
)
```
Here's some reactive stuff
```{r}
ds <- reactive({
get(input$dataset, pos="package:datasets", inherits=FALSE)
})
output$table <- renderTable({
head(ds(), input$rows)
})
tableOutput("table")
output$plot <- renderPlot({
plot(ds())
})
plotOutput("plot")
```