[英]Error in download.file; No such file or directory
我是 R 編程新手,正在嘗試從以下位置下載文件:
https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv
我使用了download.file
,我的代碼是:
url<-'https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv'
doc<-download.file(url,destfile='./test/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"
你能幫我解決這個問題嗎? 在此先感謝您的幫助。
download.file(url = "https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv", destfile = "communities.csv")
那應該做你需要的。 由於您已經在test
您沒有指定./test
因為它正在尋找.../test/test
。
這意味着您的文件存儲路徑錯誤
define destfile="storefile"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.