Re: [R] About How to check if a html directory exists

From: William Dunlap <wdunlap_at_tibco.com>
Date: Mon, 25 Apr 2011 15:34:33 -0700

Use try() or tryCatch() to let your loop continue looking for more files after download.file() throws an error.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Rolf Turner
> Sent: Monday, April 25, 2011 3:30 PM
> To: Wendy Han
> Cc: r-help_at_r-project.org
> Subject: Re: [R] About How to check if a html directory exists
>
> On 26/04/11 05:52, Wendy Han wrote:
> > Dear all,
> >
> >
> >
> > I want to let R automatically download available files from
> a website in
> > certain folders. Since the files I need, if exist, are in a certain
> > directory, I used download.file() function with a
> predesigned directory.
> > However, some of the folders do not have the file I want.
> When this occurs,
> > my program returns error and terminates. So I wonder if
> there is any way
> > that I can check if a directory exists before downloading
> that file. I
> > appreciate your help!
>
> Not quite sure I understand your question, but I think that the
> file.info() function will provide what you need. Check out
> ?file.info.
> See also ?files and ?file.access.
>
> cheers,
>
> Rolf Turner
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.
>



R-help_at_r-project.org mailing list
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. Received on Mon 25 Apr 2011 - 22:36:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Apr 2011 - 23:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive