Skip to content

Commit

Permalink
Add reactive historicData
Browse files Browse the repository at this point in the history
  • Loading branch information
mawds committed Aug 9, 2018
1 parent d3fc11f commit be77161
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions worked_example/app.R
Expand Up @@ -53,6 +53,12 @@ server <- function(input, output) {
# Create a reactive value to store the country we seleect
activeCountry <- reactiveVal()

historicData <- reactive({
gapminder %>%
filter(year <= input$year) %>%
filter(country == activeCountry()) # activeCountry is reactive, its value is accessed using activeCountry()
})

# Update the value of activeCountry() when we detect an input$plotClick event
# (Note how we update a reactiveVal() )
observeEvent(input$plotClick,
Expand Down

0 comments on commit be77161

Please sign in to comment.