The application framework
Most of the code in this chapter expands on the Google Analytics application, as described in Chapter 2, Building Your First Application. Before we begin, let's review the code in server.R
, which sets the data ready for the plotting commands. The complete code can be downloaded and run from http://chrisbeeley.net/website/:
library(dplyr) library(shiny) library(dygraphs) library(xts) library(rCharts) library(d3heatmap)
Here, we load all of the packages, which will be needed for the application. The new ones can be installed as follows:
install.packages(c("dygraphs", "xts", "d3heatmap")) require(devtools) install_github("ramnathv/rCharts")
Now, we begin with the application, using the session
argument. As described in Chapter 4, Taking Control of Reactivity, Inputs, and Outputs, this is necessary to allow us to customize the UI based on which tab is currently selected:
shinyServer(function(input, output, session) { load("gadf.Rdata") gadf$weekday = weekdays(gadf$date...