Hi,

 

Suppose

a=matrix(1:9,3,3)

 

> a

     [,1] [,2] [,3]

[1,]    1    4    7

[2,]    2    5    8

[3,]    3    6    9

 

Now,

> class(a[1:2,])

[1] "matrix"

> class(a[1:3,])

[1] "matrix"

> class(a[,1:2])

[1] "matrix"

> class(a[,1:3])

[1] "matrix"

 

 

But,

> class(a[1,])

[1] "integer"

> class(a[,1])

[1] "integer"

 

Can in a general way get class(a[1,]) or class(a[,1]) to be "matrix" only?

Shubha Karanth | Amba Research

Ph +91 80 3980 8031 | Mob +91 94 4886 4510 

Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com

 

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

