On 4/13/05, Vivek Rao <[EMAIL PROTECTED]> wrote: > I want R to stop running a script (after printing an > error message) when an array subscript larger than the > length of the array is used, for example > > x = c(1) > print(x[2]) > > rather than printing NA, since trying to access such > an element may indicate an error in my program. Is > there a way to get this behavior in R? Explicit > testing with the is.na() function everywhere does not > seem like a good solution. Thanks.
If you can restrict yourself to arrays of dimension > 1 e.g. > x <- matrix(1) > print(x[1,2]) Error in print(x[1, 2]) : subscript out of bounds then R already does that. ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
