Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
ay, November 09, 2010 8:56 AM >> To: r-help >> Subject: [R] How to program an error into an if-then statement >> >> Hello! >> >> I am running a loop (for a range of dates) and in this loop I am >> reading in different files - based on a date that is part of

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Dimitri Liakhovitski > Sent: Tuesday, November 09, 2010 8:56 AM > To: r-help > Subject: [R] How to program an error into an if-then statement > > Hello!

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Henrique Dallazuanna
Take a look in ?try and ?tryCatch myfile <- tryCatch(read.csv(myfilename), error = invisible) myfile$message On Tue, Nov 9, 2010 at 2:55 PM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Hello! > > I am running a loop (for a range of dates) and in this loop I am > reading in d

[R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
Hello! I am running a loop (for a range of dates) and in this loop I am reading in different files - based on a date that is part of the file name. However, for some of the dates, I have no file (no way to know which dates). So, when I try to read it in I get an error: Error in file(file, "rt") :