[R] About How to check if a html directory exists
wdunlap at tibco.com
Tue Apr 26 00:34:33 CEST 2011
Use try() or tryCatch() to let your loop continue looking
for more files after download.file() throws an error.
Spotfire, TIBCO Software
> -----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
> See also ?files and ?file.access.
> Rolf Turner
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help