Here is my code:
ages <- c("12", "13", "14", "15", "16", "17")
subjects <- rep(ages, 9)
date <- c("2008-05-01","2008-06-01", "2008-07-01", "2008-08-01", "2008-09-01", "2008-10-01", "2008-11-01", "2008-12-01", "2009-01-01")
date.class <- as.Date(rep(date, rep(6, length(date))))
val1 <- rnorm(54)
val2 <- rnorm(54)
val3 <- rnorm(54)
val4 <- rnorm(54)
DF <- data.frame(Subject = subjects,
Date = date.class,
Val1 = val1,
Val2 = val2,
Val3 = val3,
Val4 = val4)
library(googleVis)
M <- gvisMotionChart(DF, idvar = "Subject", timevar = "Date")
plot(M)
I would like the time variable slider on the chart to display only the dates MONTHLYthat appear in mine DF. For example, over time, I want to see only "5/1/2008", "6/1/2008", etc. GoogleVis for some reason wants to create a finer grid for the time slider and instead displays "5/1/2008", "5/2/2008", ... "5/31/2008", "6/1 / 2008, "6/2/2008", etc. I tried to mess with the option 'date.format' in the function 'gvisMotionChart'.
help (gvisMotionChart)
But I’m out of luck. Anyone have a solution?
source
share