If I understand it correctly, the sparkTable
package allows for multiple kinds of plots, but only on one series. So, for example, if my dataset df
looks like this:
variable value time Level_1 34 1947 Level_1 38 1948 Level_1 17 1949 Level_1 61 1950 Level_1 19 1951 Level_1 80 1952 Level_1 57 1953 Level_1 66 1954
i.e. the variable "value" changes over "time" across the levels of "variable", then I can draw, for instance, sparklines and bargraphs of "value" for different levels of "variable" with the following code:
library(sparkTable)
content<-list()
content[['LinePlot']]<-newSparkLine()
content[['BarPlot']]<-newSparkBar()
varType<-rep("value",2)
df<-df[,c("variable","value","time")]
df$time<-as.numeric(as.character(df$time))
dat<-reshapeExt(df,idvar="variable",varying=list(2))
sparkTab<-newSparkTable(dat,content,varType)
plotSparkTable ( sparkTab , outputType = "html", filename = "t1")
But is there any way to graph more than one series in the same output? For example, let's say I want to have one sparkline for "value", and another for cumulative of the "value" series over time (calculated by Cumulative_Value = ave(df$value, df$variable, FUN=cumsum)
)