Yoke Keong

Download files over HTTPS in R with httr

To download a file over HTTP connection, we normally use download.file command in R, for example:

1url = "http://vincentarelbundock.github.io/Rdatasets/csv/datasets/iris.csv"
2download.file(url, "iris.csv", quiet=TRUE)

For HTTPS connections, download.file may give you some issues. In situations like this you can consider using the httr package to download files:

1library(httr)
2url <- "https://rawgit.com/yoke2/dsxref/master/iris.xlsx"
3GET(url, write_disk("iris.xlsx", overwrite=TRUE))

<< Previous Post

|

Next Post >>

#Httr #R