2014-11-05 82 views
2

我想下載一個excel zip文件到我已經開始的R Project文件夾中。我是R新手,所以我對收到的錯誤信息有點困惑。權限被拒絕下載文件時出錯

該文件是一個excel文件等第一I創建的變量爲文件:

excel2file="http://op.nsf.data/dataFiles/Housing2013EXCEL.zip" 

然後我使用的編碼:

download.file(excel2file, destfile= "~/Home/Documents/Data") 

我收到此錯誤消息:

Error in download.file(excel2file, destfile = "~/Home/Documents/Data") : 
    cannot open destfile '~/Home/Documents/Data', reason 'Permission denied' 

我試着查看拒絕的權限的其他示例,我認爲它可能是我的目標文件,但我我不確定爲什麼要採取措施來解決問題。

回答

6

destfile應該是文件名,而不是目錄。例如:

download.file(excel2file, destfile= "~/Home/Documents/Data/Housing2013EXCEL.zip") 

此外,該URL似乎並不有效,但是這是一個不同的(非R)的問題。