Download simultaneously using download.file

Starting with version 3.2.1, an official R official document says there is support for simultaneous downloads. Below is the quoted text from the help file:

Support for the libcurl method is optional: use the features (libcurl) to find out if it is supported in your assembly. It provides (non-blocking) access to the https: // and ftps: // URLs. There is support for simultaneous loading, so url and destfile can be character vectors of the same length, more than one. For one URL and quiet = FALSE, a progress bar is displayed in interactive use.

But when I tried to download two files from two different sites, it downloaded only one:

url_list<-c("http://cran.r-project.org/doc/manuals/r-patched/R-exts.html","http://cran.r-project.org/doc/manuals/r-patched/NEWS.pdf") dest_list<-c("test1.html","test2.pdf") download.file(url_list,dest_list) trying URL 'http://cran.r-project.org/doc/manuals/r-patched/R-exts.html' Content type 'text/html' length 874175 bytes (853 KB) downloaded 853 KB Warning messages: 1: In download.file(url_list, dest_list) : only first element of 'url' argument used 2: In download.file(url_list, dest_list) : only first element of 'destfile' argument used 

Then I saw that I skipped using the argument method="libcurl"

 download.file(url_list,dest_list,method="libcurl"). 

As soon as I run this command in RStudio: R Studio gives a fatal warning and the R session is terminated. With the R GUI for Windows, the following warning appears (and then turns off):

R for the Windows GUI interface stops working. "The problem caused the program to stop working correctly. Windows will close the program and let you know if a solution is available."

I am using Windows 8.0. I also ran capabilities("libcurl") and produced the following output.

 libcurl TRUE 
+7
r download
source share
1 answer

According to @thelatemail's comment: setting quiet=TRUE gives the desired result (which means this is due to the progress bar):

 download.file(url_list,dest_list,method="libcurl",quiet=TRUE) 
+3
source share

All Articles