[R] subsetting a matrix

Rajarshi Guha rxg218 at psu.edu
Tue Sep 30 19:10:12 CEST 2003


Hi,
  I'm trying to take a set of rows and columns out of a matrix. I hve
been using the index aray approach. My overll matrix is X and is 179 x
65. I want to take out 4 columns and 161 rows.

Thus I made a 161 x 2 array I and filled it up with the row,col indices.
However doing,

X[ I ] gives me a vector of the extracted elements. Is there anyway I
can coerce this into a 161 x 4 matrix?

-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Disembowelling takes guts.




More information about the R-help mailing list