O'Reilly logo

Web Application Development with R Using Shiny by Chris Beeley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animation

Animation is surprisingly easy. The sliderInput() function that you have already seen, which is used to select the hours of interest within the application, has an optional animation function that will increment a variable by a set amount every time a specified unit of time elapses. This allows you to very easily produce a graphic that animates. In the following example we are going to look at the monthly graph and plot a linear trend line through the first 20% of the data (0 to 20% of the data). Then we are going to increment the percentage value that selects the portion of the data by 5% and plot a linear through that portion of data (5 to 25% of the data). Then increment again to 10 to 30% and plot another line, and so on. The following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required