[R] Error: subscript out of bounds.

Rolf Turner r.turner at auckland.ac.nz
Tue Sep 23 04:16:39 CEST 2008


Consider:

	> x <- array(1:12,dim=12)
	> x[13]
	[1] NA]
	> m <- array(1:12,dim=c(3,4))
	> m[3,5]
	Error: subscript out of bounds

Can anyone tell me it there is a Good Reason for the difference in  
behaviour
between 1 dimensional and higher dimensional arrays?  In a bit of  
code that
I was working on I expected the NA behaviour and didn't get it of  
course.  Then
I had to take evasive action to avoid the error.

Naive young thing that I am, I would prefer the NA behaviour to be  
universal.
But I expect that, as usual, I'm overlooking something.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list