Thank you very much Mark! That worked.... Just a question, ?[ does give an error to me...how do I find it?
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 -----Original Message----- From: Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 8:50 PM To: 'Mark Leeds' Subject: RE: [R] To preserve the class "Matrix" Thank you very much Mark! That worked.... Just a question, ?[ does give an error to me...how do I find it? 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 -----Original Message----- From: Mark Leeds [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 8:46 PM To: Shubha Vishwanath Karanth Subject: RE: [R] To preserve the class "Matrix" Hui Shubha: If I understand what you're asking, you want to use drop=FALSE as in a[1,,drop=FALSE] That retains the dimension ( ie, the matrixness ) of the object. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 11:07 AM To: [EMAIL PROTECTED] Subject: [R] To preserve the class "Matrix" 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 Josi * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This e-mail may contain confidential and/or privileged i...{{dropped:10}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.