Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R produces "unsupported URL scheme" error when getting data from https sites

Tags:

r

knitr

R version 3.0.1 (2013-05-16) for Windows 8 knitr version 1.5 Rstudio 0.97.551

I am using knitr to do the markdown of my R code. As part of my analysis I downloaded various data sets from the web, knitr is totally fine with getting data from http sites but from https ones where it generates an unsupported URL scheme message. I know when using the download.file function on a mac the method parameter has to be set to curl to get data from an https however this doesn't help when using knitr.

What do I need to do so that knitr will gather data from Https websites?

Edit: Here is the code chunk that returns an error in Knitr but when run through R works without error.

```{r}
fileurl <- "https://dl.dropbox.com/u/7710864/data/csv_hid/ss06hid.csv"
download.file(fileurl, destfile = "C:/Users/xxx/yyy")
```
like image 334
Jonno Bourne Avatar asked Nov 10 '13 14:11

Jonno Bourne


1 Answers

Using the R download package takes care of the quirky details typically associated with file downloads. For you example, all you needed to do would have been:

```{r}
library(download)
fileurl <- "https://dl.dropbox.com/u/7710864/data/csv_hid/ss06hid.csv"
download(fileurl, destfile = "C:/Users/xxx/yyy")
```
like image 145
Michael Szczepaniak Avatar answered Oct 08 '22 06:10

Michael Szczepaniak