r - Update graph/plot with fixed interval of time -


i have plot in shiny ui. if change input parameter , through reactivity plot change. let's consider following situation:- plot in shiny ui plotting let intra-day price move of stock. , query live data source. if create refresh button , if time passes keep on clicking on refresh button. plot updated new data arrives time goes live data source. question don't want keep clicking on refresh button. want run loop timer check on fixed interval of time , new data comes plot auto update. sort of google finance graphs keeps updating on time.

so problem can simplified follows :- let's consider example shiny :- ui.r

library(shiny)      shinyui(pagewithsidebar(        headerpanel("hello shiny!"),    sidebarpanel(     sliderinput("obs",                  "number of observations:",                  min = 1,                 max = 1000,                  value = 500)   ),    mainpanel(     plotoutput("distplot")   ) )) 

and server.r

library(shiny)  shinyserver(function(input, output) {    output$distplot <- renderplot({      # generate rnorm distribution , plot     dist <- rnorm(input$obs)     hist(dist)   })  }) 

now want generate different random sample normal distribution without input activity. want call

dist <- rnorm(input$obs) hist(dist) 

again without changing sliderinput. please me find out how that.

as example can run following locally:

library(shiny)  runapp(list(   ui = pagewithsidebar(        headerpanel("hello shiny!"),    sidebarpanel(     sliderinput("obs",                  "number of observations:",                  min = 1,                 max = 1000,                  value = 500)   ),    mainpanel(     plotoutput("distplot")   ) ),   server =function(input, output, session) {     autoinvalidate <- reactivetimer(5000, session)     output$distplot <- renderplot({       autoinvalidate()       # generate rnorm distribution , plot       dist <- rnorm(input$obs)       hist(dist)     })    } )) 

a different normal sample generated every 5 seconds


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo