[R] convert matrix to data frame

From: Chia, Yen Lin <yen.lin.chia_at_intel.com>
Date: Fri 06 Jan 2006 - 10:11:18 EST

Hi all,  

Suppose I have a 4 x 2 matrix A and I want to select the values in second column such that the value in first column equals to k.  

I gave the colnames as alpha beta, so I was trying to access the info using  

A$beta[A[,1]==k], however, I was told it's not a data frame, I can get the object by using dollar sign. I tried data.frame(A), but it didn't work.  

Any input on this will be very appreciated. Thanks.  

I tried looking in the manual, but I think I'm might be wrong about the keywords.  

Yen Lin

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jan 06 10:18:46 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:53 EST