[R] Extracting only odd columns from a matrix
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Thu Mar 10 02:40:42 CET 2011
Xonly <- XY[, grep("^X", dimnames(XY)[[2]])]
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Nixon, Matthew
Sent: Thursday, 10 March 2011 12:20 AM
To: r-help at R-project.org
Subject: [R] Extracting only odd columns from a matrix
Hi,
This might seem like a simple question but at the moment I am stuck for ideas. The columns of my matrix in which some data is stored are of this form:
X1 Y1 X2 Y2 X3 Y3 ... Xn Yn
with n~100. I would like to look at just the X values (i.e. odd column numbers). Is there an easy way to loop round extracting only these columns?
Any help would be appreciated.
Thank you.
______________________________________________
R-help at 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.
More information about the R-help
mailing list