If I understand correctly, sparkTable allows several types of graphs, but only in one series. So, for example, if my df dataset 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 “value” variable changes in “time” by the “variable” levels, then I can, for example, draw lines and bargraphs of “value” for different levels of the “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 a way to build more than one row on one output? For example, suppose I want to have one spark line for “value” and another for the cumulative series “value” with time (calculated Cumulative_Value = ave(df$value, df$variable, FUN=cumsum) )
source share