Use reactivePoll to accumulate output data

I recently noticed reactivePoll() , but I need help to figure this out for my use case.

I want to copy the data to a vector, list, or data.frame (it does not matter), and then build the data, with a user interface showing a graph with the accumulation of data as new data arrives. See how to add new data to old data without replacing old data. In this example ( https://gist.github.com/sckott/7388855 ) I get only the initial row in data.frame, and the latest one does not accumulate all the data. In this example, how can I increase the data.frame by adding new ones data below?

+7
r shiny
source share
1 answer

This can be done using the reactiveValues function:

 runApp( list( ui = mainPanel( tableOutput(outputId="dataTable") ), server = function(input, output, session) { myReact <- reactiveValues(df =data.frame(time=Sys.time())) readTimestamp <- function() Sys.time() readValue <- function(){ data.frame(time=readTimestamp()) } data <- reactivePoll(1000, session, readTimestamp, readValue) observe({ myReact$df <- rbind(isolate(myReact$df), data()) }) output$dataTable <- renderTable({ myReact$df }) }) ) 
+7
source share

All Articles