首页 文章

download.file出错;没有相应的文件和目录

提问于
浏览
0

我是一个R和编程newb,并试图从以下位置下载文件:

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 回答

  • 0

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

    那应该做你需要的 . 因为你已经在 test ,所以你没有指定 ./test ,因为那里正在寻找 .../test/test .

相关问题