Since the version 3.2.1, the official R document says that there is support for simultaneous downloads. Following is the quoted text from help file:
Support for method "libcurl" is optional: use capabilities("libcurl") to see if it is supported on your build. It provides (non-blocking) access to https:// and ftps:// URLs. There is support for simultaneous downloads, so url and destfile can be character vectors of the same length greater than one. For a single URL and quiet = FALSE there a progress bar is shown in interactive use.
But when I tried to download two files from two different websites, 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 missed using an argument method="libcurl"
download.file(url_list,dest_list,method="libcurl").
Once I run this command in RStudio: R Studio gives fatal warning and R session gets aborted. With the R for Windows GUI, the following warning occurs (and then shut down):
R for Windows GUI front-end has stopped working. "A problem caused the program to stop working correctly. windows will close the program and notify you if a solution is available.".
I am using Windows 8.0. I also ran capabilities("libcurl")
and it gives the following output.
libcurl
TRUE
As per the comment of @thelatemail: setting quiet=TRUE
gives the desired result (which means it is due to the progress bar):
download.file(url_list,dest_list,method="libcurl",quiet=TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With