[Rd] Subscripting Matrices
Terrence Ireland
kyzyl at his.com
Wed Aug 6 17:07:42 CEST 2014
There seems to be a result type difference when subscripting a 6 x 1
matrix as compared to a 3 x 2 matrix that is caused by the ncol = 1
compared to ncol > 1.
> ThinMatrix <- matrix(1:6,ncol=1)
> ThinMatrix
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
> FatMatrix <- matrix(1:6,ncol=2)
> FatMatrix
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
> dim(ThinMatrix[TRUE,])
NULL #Though this value should be 6 1
> dim(FatMatrix[TRUE,])
[1] 3 2
Thanks for your help.
Terry Ireland
More information about the R-devel
mailing list