2012-10-22 27 views
1

当我想创建一个使用从googleVis的gvisGeoMap()地图,我得到错误:GoogleVis,地理分布图绘制错误

## Using the google visualization API with R 
library(googleVis) 
input<- read.csv("data.csv") 

select<- input[which(input$Subgroup=="Total 5-14"),] 
select<- input[which(input$Subgroup=="Total 5-14 yr"),] 

Map<- data.frame(select$Country.or.Area, select$Value) 
names(Map)<- c("Country", "Percentage") 
Geo=gvisGeoMap(Map, locationvar="Country", numvar="Percentage", 
options=list(height=350, dataMode='regions')) 

plot(Geo) 
#starting httpd help server ... done 
#Error in ifelse(interactive(), getOption("browser"), "false") : 
#replacement has length zero 

以上是在“RGUI”的错误。 “RStudio”中的错误消息是不同的:

#object of type 'closure' is not subsettable 

并且浏览器根本不会触发。 HTTP服务器工作正常,因为我可以简单地调用帮助页面(例如?googleVis将启动浏览器并提供帮助页面)。上面的代码中的“Geo”对象很好,只包含html代码,而plot()并不做它应该做的事情(我可以​​手动运行临时文件夹中的html文件并查看结果)。上面的例子可用here

我很感激你的线索。

谢谢

+1

由于文件'data.csv'是您的计算机上而已,我们是不是能够重现错误。 –

+0

非常感谢你,我忘了附上文件。但是,在小插曲(googleVis)pdf中运行示例时,我遇到了同样的错误。如果有人有时间运行上面的代码,data.csv就在这里:https://sites.google.com/site/geosciej/Home/data.csv?attredirects=0&d=1 –

回答

0

这是与包的作者对应的结果。看来有一个错误,阻止了阴谋正常工作。发布了一个新版本。你可以找到下面的链接。 TQ

..... 昨天晚上我意识到GoogleVis 0.3.0版本不幸在Windows的RStudio和R中引入了一个bug。 该错误已被修复,并且我们的项目网站(here is the link)提供了新版本(0.3.1),但尚未在CRAN上发布。

我已经在我的博客(here is the link)上写了一个注释以通知其他人。

我希望这会有所帮助。

问候

马库斯