Finally, I'm getting to a point in working with R where I would like to start 
to add some smart and custom error handling.  

Specifically, I would like to add custom error handling to my code for 
source(...), read.table(...), and readLines(...)

For example, right now I have the following:
> postprocesspath<-c("C:/")
> postprocess_scriptname<-c("Bob.R")
> fullpostpocessingpath<-paste(postprocesspath, postprocess_scriptname, sep="")
> source(fullpostpocessingpath)
Error in file(file, "r", encoding = encoding) : 
  cannot open the connection
In addition: Warning message:
In file(file, "r", encoding = encoding) :
  cannot open file 'C:/Bob.R': No such file or directory


Instead of the error shown above, I would just like to simply have the last 
line "cannot open file 'C:/Bob.R': No such file or directory" Or, add my own 
statement to the above, e.g. 

##########################################################
##########################################################
[[elided Yahoo spam]]
##########################################################
##########################################################


I would like to do something similar for read.table(...) and readLines(...).


Is such a thing possible? 

Thanks again.

______________________________________________
R-help@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.

Reply via email to