Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in download.file unsupported URL scheme

I am working with an algorithm R that calls a webservice that makes a query to a database and returns a JSON object.

url <- "https://example.com?id=1"
json_file <- "C:/xampp/htdocs/example/Download/data.json"
download.file(url, json_file)
document <- fromJSON(json_file)

On my machine the algorithm usually works bad when I go up to the server and run, I get the following error:

Error in download.file(url, json_file) : unsupported URL scheme

here is some problem for the url be https?

like image 912
perondi Avatar asked Feb 18 '14 14:02

perondi


2 Answers

From the Details section of ?download.file.

 Note that 'https://' URLs are only supported if '--internet2' or
 environment variable 'R_WIN_INTERNET2' was set or
 'setInternet2(TRUE)' was used (to make use of Internet Explorer
 internals), and then only if the certificate is considered to be
 valid.
like image 111
Richie Cotton Avatar answered Oct 08 '22 06:10

Richie Cotton


In Ubuntu, you can use method = "curl" to use curl to download.

like image 32
j605 Avatar answered Oct 08 '22 05:10

j605