2013-04-10 75 views
2

我試圖用下面的代碼爲什麼我的download.file文件無法完成?

L <- lapply(urls, read.xls, sheet=1,header=T,skip=1,perl="C:/perl/bin/perl.exe",row.names=NULL) 

檢索幾十個文件從一個網站(地址爲urls列出)​​但也有少數成功下載後,我一直收到此錯誤:

Trying URL 'http://www.xyz.com' 
Error in download.file(xls, tf, mode = "wb") : 
    cannot open URL 'http://www.xyz.com' 
In addition: Warning message: 
In download.file(xls, tf, mode = "wb") : 
    cannot open: HTTP status was '0 (nil)' 
Error in file.exists(tfn) : invalid 'file' argument 

爲什麼我得到這個錯誤?

回答

1

該錯誤是由默認timeout選項引起的,該選項設置爲其默認值60秒。

您可以通過調用檢索:

getOption("timeout") 

要改變它,你只需運行options(timeout = X),其中X是在幾秒鐘內你想要的超時。

相關問題