2014-07-25 38 views
0

我是一個R和編程福利局,並試圖從下載文件:download.file中的錯誤;沒有這樣的文件或目錄

https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv

我用download.file和我的代碼是:

網址< - 'https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv '

DOC < -download.file(URL,destfile ='/測試/ communities.csv')

我得到一個錯誤:

錯誤download.file(URL,destfile = 「./test/communities.csv」): 無法打開destfile './test/communities.csv',原因 '沒有這樣的文件或目錄'

但是當我檢查使用getwd()我的工作目錄就說明它的存在:

getwd() [1] "C:/Users/puneet.kumar/Desktop/R practice/R lesson/Data cleaning/test"

能否請你幫我這個。預先感謝您的幫助。

+1

測試文件夾中可能沒有測試文件夾。因此,使用'destfile ='communities.csv''或'destfile ='../test/communities.csv''。 – lukeA

回答

0

download.file(url = "https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv", destfile = "communities.csv")

這應該做你所需要的。由於您已經在test中,因此您沒有指定./test,因爲這是在尋找.../test/test

相關問題