My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 9: Undefined "combinations of idvar and timevar" error
2 people starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Dec 2011


 
Reported by dr.zan...@gmail.com, Dec 21, 2011
What steps will reproduce the problem?
1. Loading data from console: time <- c("12.15.2011 7:41:52", "12.15.2011 7:43:07", "12.15.2011 17:53:08", "12.15.2011 17:58:19", "12.15.2011 17:59:13", "12.15.2011 18:09:33", "12.15.2011 18:14:02", "12.15.2011 18:16:11", "12.15.2011 18:24:07", "12.15.2011 18:32:27", "12.15.2011 20:00:33", "12.15.2011 20:49:44", "12.15.2011 22:04:33", "12.15.2011 23:03:45", "12.15.2011 23:25:37", "12.16.2011 2:48:53", "12.16.2011 5:47:36", "12.16.2011 9:47:38", "12.16.2011 19:34:55", "12.16.2011 19:52:47", "12.16.2011 19:53:19", "12.16.2011 19:53:37", "12.16.2011 20:13:50", "12.16.2011 21:06:16", "12.16.2011 21:35:09", "12.16.2011 21:46:28", "12.16.2011 22:30:20", "12.16.2011 23:57:28", "12.17.2011 11:31:57", "12.17.2011 11:44:14", "12.17.2011 14:37:00", "12.18.2011 13:10:15", "12.19.2011 11:09:43", "12.19.2011 13:59:43", "12.19.2011 14:20:26", "12.19.2011 14:47:19", "12.19.2011 19:37:59", "12.20.2011 12:41:37", "12.20.2011 13:04:03", "12.20.2011 13:46:25")
choice <- c("Option 1", "Option 2", "Option 1", "Option 2", "Option 2", "Option 1", "Option 2", "Option 1", "Option 1", "Option 2", "Option 2", "Option 1", "Option 2", "Option 2", "Option 2", "Option 1", "Option 2", "Option 1", "Option 2", "Option 2", "Option 1", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 1", "Option 1", "Option 2", "Option 1", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2", "Option 2")
data <- data.frame(time, choice)

2. Transforming dateTime stamp to date format:
data$time <- strptime(data$time, "%m.%d.%Y %H:%M:%S")
data$time <- as.Date(data$time, format="%Y-%m-%d %H:%M:%S")

3. Starting googleVis library and trying to use gvisMotionChart function:
library(googleVis)
M <- gvisMotionChart(data, idvar = "choice", timevar="time")

I get an error:
Error in gvisCheckMotionChartData(data, my.options) : 
  The data must have rows with unique combinations of idvar and timevar.
Your data has 40 rows, but idvar and timevar only define 10 unique rows.

If I call fix(data), I see that everything is fine with my data. All 40 cases are defined properly.


I have R 2.13.2,  googleVis version 0.2.12, Windows 7 OS.



Please provide any additional information below.


Dec 21, 2011
Project Member #1 markus.g...@googlemail.com
## I can confirm that I get the same message:

M <- gvisMotionChart(data, idvar = "choice", timevar="time")
## Error in gvisCheckMotionChartData(data, my.options) : 
##   The data must have rows with unique combinations of idvar and timevar.
##  Your data has 40 rows, but idvar and timevar only define 10 unique rows.

head(data)

##         time   choice
## 1 2011-12-15 Option 1
## 2 2011-12-15 Option 2
## 3 2011-12-15 Option 1
## 4 2011-12-15 Option 2
## 5 2011-12-15 Option 2
## 6 2011-12-15 Option 1

## 
## Your data set has, as the error message suggest several values for the same date.
## For 2011-12-15 Option 1 appears several times.
## A motion chart requires unique rows for each 'idvar' / 'timevar' combination. 
## Further, a value to plot is missing.
## I suggest that you aggregate your data to a day level first.
##
## Here is an extended example which works for me:

df=unique(data)
df$value=rnorm(nrow(df))
M <- gvisMotionChart(df, idvar = "choice", timevar="time")
plot(M)

## Your observation is as expected.
## Please let me know if we can improve the documentation.
Dec 21, 2011
#2 dr.zan...@gmail.com
Yes, I've already solved the problem. I had to make my data matrix as follows:
time choice quantity
date1 Option 1 Sum_of_Option 1_occurancies_on_date1
date1 Option 2 Sum_of_Option 2_occurancies_on_date1
date2 Option 1 Sum_of_Option 1_occurancies_on_date2
date2 Option 2 Sum_of_Option 2_occurancies_on_date2
...
Now have the graph:
http://masscom.ucoz.ua/test.html
Dec 21, 2011
Project Member #3 markus.g...@googlemail.com
I am glad to hear that you could solve your issue.
Status: Invalid

Powered by Google Project Hosting