[R] Downloading a directory of text files into R

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Jul 26 01:13:25 CEST 2023


You cannot read files using name patterns. You can use list.files with patterns on your local filesystems, and you can use RCurl or httr contributed packages to parse out the web listing of files returned by the web server.  See the example in ?RCurl. Then you can download the individual files in an lapply or for loop.

On July 25, 2023 3:06:07 PM PDT, Bob Green <bgreen using dyson.brisnet.org.au> wrote:
>Hello,
>
>I am seeking advice as to how I can download the 833 files from this site:"http://home.brisnet.org.au/~bgreen/Data/"
>
>I want to be able to download them to perform a textual analysis.
>
>If the 833 files, which are in a Directory with two subfolders were on my computer I could read them through readtext. Using readtext I get the error:
>
>> x = readtext("http://home.brisnet.org.au/~bgreen/Data/*")
>Error in download_remote(file, ignore_missing, cache, verbosity) :
>  Remote URL does not end in known extension. Please download the file manually.
>
>> x = readtext("http://home.brisnet.org.au/~bgreen/Data/Dir/()")
>Error in download_remote(file, ignore_missing, cache, verbosity) :
>  Remote URL does not end in known extension. Please download the file manually.
>
>Any suggestions are appreciated.
>
>Bob
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list