在PC上使用download.file进行Web数据时出错

时间:2014-11-14 16:30:20

标签: download

我的代码:

url< - “http://dl.dropboxusercontent.com/u/26929842/ug_sch_apps.csv

download.file(url,destfile =“。/ old_sch_apps.csv”,method =“curl”)

list.files(“./ug_sch_apps.csv”) download_date =日期()

ug_sch_apps< - read.csv(“./ data / ug_sch_apps.csv”,
                         stringsAsFactors = F)

收到我的错误:

文件错误(文件,“rt”):无法打开连接 另外:警告信息: 在文件(文件,“rt”)中:   无法打开文件'./data/ug_sch_apps.csv':没有这样的文件或目录

1 个答案:

答案 0 :(得分:0)

您似乎忘记了https://

中的s

使用以下代码:

url <- "https://dl.dropboxusercontent.com/u/26929842/ug_sch_apps.csv"

download.file(url, destfile = "./data/ug_sch_apps.csv", method="curl")

ug_sch_apps <- read.csv("./data/ug_sch_apps.csv" , stringsAsFactors=F)