我希望仅在按下按钮时才重新呈现此图表updt
。这是我到目前为止的代码
---
title: ""
author:
output:
flexdashboard::flex_dashboard:
storyboard: true
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(dplyr)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
actionButton('updt', 'Update chart')
checkboxGroupInput('gear', 'number of gears', unique(mtcars$gear), (mtcars$gear))
observeEvent( eventExpr = input$updt , handlerExpr = {
renderPlot({
dd <- mtcars %>% filter(gear %in% input$gear)
f1 <- ggplot(aes(mpg, disp), data=dd) + geom_point()
f1
})
})
```