2013-02-27 93 views
0

我正在第一次使用R包BerkeleyEarth,並試圖使用其便利功能訪問BEST數據。我認爲也許這只是他們服務器的一個問題(我已經分別向該軟件包的維護者發送了一個問題),但我想知道這是否是我正在做的傻事。使用R包BerkeleyEarth

要重現我的錯

library(BerkeleyEarth) 
downloadBerkeley() 

它提供了以下錯誤消息

trying URL 'http://download.berkeleyearth.org/downloads/TAVG/LATEST%20-%20Non-seasonal%20_%20Quality%20Controlled.zip' 
Error in download.file(urls$Url[thisUrl], destfile = file.path(destDir, : 
    cannot open URL 'http://download.berkeleyearth.org/downloads/TAVG/LATEST%20-%20Non-seasonal%20_%20Quality%20Controlled.zip' 
In addition: Warning message: 
In download.file(urls$Url[thisUrl], destfile = file.path(destDir, : 
    InternetOpenUrl failed: 'A connection with the server could not be established' 

有沒有人有采用這種封裝形式有更好的體驗?

+0

我能夠用以下方式下載它:install.packages('BerkeleyEarth');圖書館(BerkeleyEarth);我從來沒有使用過downloadBerkeley()這一行,但不知道它的作用。 – 2013-02-27 18:47:28

+0

包下載正常 - CRAN沒有問題。 downloadBerkeley()是訪問BEST數據包的函數,它是我在上面發佈的錯誤消息的來源。 – tomw 2013-02-27 18:53:25

+0

我明白了。謝謝。當我嘗試使用downloadBerkeley()時,我也遇到了錯誤。也許我們沒有正確使用downloadBerkeley()。我能夠直接從他們的網站下載所有的數據集。 – 2013-02-27 19:01:12

回答

3

錯誤消息指向的URL不同,應該判斷哪些URL在http://berkeleyearth.org/data/上列出,指向zip格式的文件。還有另外一組.nc文件看起來更近。我會滿足您的分析策略的那些替換BerkeleyUrls數據幀中的條目:

這是當前的URL,應在1,1位置:

http://berkeleyearth.lbl.gov/downloads/TAVG/LATEST%20-%20Non-seasonal%20_%20Quality%20Controlled.zip 

這是一個是在包數據幀:

> BerkeleyUrls[1,1] 
[1] "http://download.berkeleyearth.org/downloads/TAVG/LATEST%20-%20Non-seasonal%20_%20Quality%20Controlled.zip" 

我想你可以嘗試:

BerkeleyUrls[, 1] <- sub("download\\.berkeleyearth\\.org", "berkeleyearth.lbl.gov", BerkeleyUrls[, 1]) 
+0

真棒,這完美的作品。謝謝! – tomw 2013-02-27 20:18:44