[R] how to use conditional statements to handle exceptions?

Roger D. Peng rpeng at jhsph.edu
Tue Mar 9 19:17:02 CET 2004


Take a look at try().

-roger

Susan Lin wrote:
> Hello,
> 
> I have a problem to handle the following statements.
>   
>   for(i in [1:3])
>   {
>     file=paste("file", i, ".dat")
>     bb <- read.table(file)
>     x11()
>     plot(bb)
>     dev.off()
> 
>   }
> When the input .dat file is empty, the program stops
> running and an error message appears. Could someone
> tell me how to handle this exception?
> 
> Thanks
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list