[R] Matrix manipulation

Winfried Theis theis at statistik.uni-dortmund.de
Wed May 23 13:24:03 CEST 2001


Hi!
On 23-May-01 Ko-Kang Kevin Wang wrote:
> Hi,
> 
> Suppose I have a matrix with, say 12 columns.
> 
> I would like to extract out column 2 ~ 8 and 11 ~ 12 then combine them
> together.
> 
> I tried with success to extract out the columns by doing:
>  foo <- test[,2:8]
>  goo <- test[,11:12]
> 
Hmm, how about 

foo <- test[,c(2:8,11:12)]

this gives you a matrix including columns 2-8 and 11,12.

Cheers, 

Winfried

----------------------------------
E-Mail: Winfried Theis <theis at statistik.uni-dortmund.de>
Date: 23-May-01
Time: 12:21:32
Dipl.-Math. Winfried Theis, Fachbereich Statistik, Graduiertenkolleg
"Angewandte Statistik"
Universität Dortmund, 44221 Dortmund
Tel.: +49-231-755-5903  FAX: +49-231-755-4387
----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list