GoogleVis无法在R中工作:运动图无法在浏览器中加载.正在获取空白浏览器



我在让GoogleVis工作时遇到问题。当我使用GoogleVis绘图时,我会得到一个空白的浏览器。以下是我所做的:

  1. 我使用了内置的R数据集"ChickWeight">
  2. 已安装RJSONIO和googleVis软件包
  3. 为了简单起见,我将ChickWeight数据帧截断为24行:ChickWeight1&lt-小鸡体重[1:24,]
  4. 然后调用gvisMotionChart函数,为其指定一个对象:可视化1&lt-gvisMotionChart(ChickWeight1,idvar='weight',timevar='Time')
  5. 运行上面的代码会给我一条警告信息。不确定警告消息是否相关:

警告消息:在if(class(x[[.x]])=="Date")中为.character(x[.x]]])else x[[.x]]:条件的长度>1,并且只有第一个元素将被使用

  1. 然后我绘制了对象:plot(可视化1)

我本以为会有一个运动图,但我只得到了一个空白的浏览器。我还尝试将"Time"列从数字类转换为日期类,但没有成功。

我使用的是R 3.0.2、Mac OS X 10.6.8版和Safari 5.1.2版(6534.52.7)。我也在我的Windows笔记本电脑上运行了同样的代码,但运气不好。

如有任何反馈,我们将不胜感激!谢谢

键入后出现的完整错误

mchart1<-gvisMotionChart(ChickWeight1,idvar='weight',timevar='Time')为:

Error in gvisCheckMotionChartData(data, my.options) : The data must have rows with unique combinations of idvar and timevar. Your data has 578 rows, but idvar and timevar only define 375 unique rows. In addition: Warning message: In if (class(x[[.x]]) == "Date") as.character(x[[.x]]) else x[[.x]] : the condition has length > 1 and only the first element will be used

这个错误会让你知道你没有指定小鸡的id。如果你做mchart1<-gvisMotionChart(ChickWeight,idvar='Chick',timevar='Time'),这将为你提供小鸡如何随时间增加体重的运动图。

CCD_ 4是非常有用的。

最新更新