[R] How to generate an error message when 'match' does not find any matches?

Peng Yu pengyu.ut at gmail.com
Sun Aug 23 02:36:22 CEST 2009


> match(4, c(1,2,3))
[1] NA

The above code run smoothly. It would not stop when 4 does not mach in
c(1,2,3). I am wondering if there is a way to stop the code and pop up
an error message immediately. This capability to stop will make
debugging easier.


More information about the R-help mailing list