[R] Subsetting a matrix [Again!]

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue Jul 15 13:01:02 CEST 2003


On 15-Jul-03 Achim Zeileis wrote:
>> >[...]
>> > mu1<-mu[iX1,drop=FALSE]; mu2<-mu[iX2,drop=FALSE];
>> > mu1
>>
>> [1] 1
>>
>> > mu2
>>
>> [1] 2 3
>>
>> So now I still don't get my 1xk matrices, even though mu is a
>> matrix and I've used "drop=FALSE". Why?
> 
> Because you are subsetting mu like a vector not like a matrix. The 
> following produces the desired output:
> 
> R> mu1<-mu[,iX1,drop=FALSE]; mu2<-mu[,iX2,drop=FALSE];

Thanks!! (Must have some coffee).
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 15-Jul-03                                       Time: 12:01:02
------------------------------ XFMail ------------------------------




More information about the R-help mailing list