What are the functions to download a URL list in R

2019-08-17 02:08发布

问题:

This question already has an answer here:

  • Download multiple files using “download.file” function 1 answer
  • Downloading multiple file as parallel in R 3 answers
  • HTTP error 400 in R, error handling, How to retry instead of forcing to stop? 1 answer
  • Skip to the next iteration when download.file takes too long 1 answer

I have a URL list in R and want to download it.

However, I do not like to use download.file() as this function gives me error when my list is big (more than 500 links):

InternetOpenUrl failed: 'The operation timed out'

Here is the download list:

list_1 <- c("https://e4ftl01.cr.usgs.gov//MODV6_Cmp_A/MOLT/MOD11B3.006/2004.12.01/MOD11B3.A2004336.h18v08.006.2015240192212.hdf",
        "https://e4ftl01.cr.usgs.gov//MODV6_Cmp_A/MOLT/MOD11B3.006/2004.12.01/MOD11B3.A2004336.h19v07.006.2015240192220.hdf",
        "https://e4ftl01.cr.usgs.gov//MODV6_Cmp_A/MOLT/MOD11B3.006/2004.12.01/MOD11B3.A2004336.h19v08.006.2015240192212.hdf",
        "https://e4ftl01.cr.usgs.gov//MODV6_Cmp_A/MOLT/MOD11B3.006/2004.12.01/MOD11B3.A2004336.h18v07.006.2015240192213.hdf")

list_1

Any idea to download this list using a better function in R?

Thanks so much.