如何将融合表数据下载到R中

时间:2015-02-14 15:34:47

标签: r

我正在尝试将伊拉克维基解密数据下载到R中,但需要帮助才能成功完成。我最终没有理解结果"暂时移动"

此页面上有几个链接。

http://www.theguardian.com/news/datablog/2010/oct/23/wikileaks-iraq-data-journalism#data

我尝试下载使用此代码无需登录的融合表。

库(RCurl)

x = getURL(" http://www.google.com/fusiontables/exporttable?query=select+col0%2Ccol1%2Ccol2%2Ccol3%2Ccol4%2Ccol5%2Ccol6%2Ccol7%2Ccol8%2Ccol9%2Ccol10%2Ccol11%2Ccol12%2Ccol13%2Ccol14%2Ccol15%2Ccol16%2Ccol17%2Ccol18+from+273326")

y< - read.csv(text = x)

然而,这就是我最终的所有结果。

  

STR(y)的   ' data.frame':8 obs。 1个变量:    $ X.HTML。:因子w / 8级"","",..:6 7 2 4 5 8 1 3   ÿ                                                                                                  X.HTML。   1   2暂时移动   3   4   5

暂时移动

  6该文件已移至http://www.google.com/fusiontables/DataSource?dsrcid=273326>here。   7   8

1 个答案:

答案 0 :(得分:1)

y<-download.file("http://www.google.com/fusiontables/exporttable?query=select+col0%2Ccol1%2Ccol2%2Ccol3%2Ccol4%2Ccol5%2Ccol6%2Ccol7%2Ccol8%2Ccol9%2Ccol10%2Ccol11%2Ccol12%2Ccol13%2Ccol14%2Ccol15%2Ccol16%2Ccol17%2Ccol18+from+273326",destfile="iraq.csv")
# file iraq.csv will be stored in your working directory

my_data<-read.csv("iraq.csv")
head(my_data)