[R] Matrix manipulation

Roger Bivand Roger.Bivand at nhh.no
Wed May 23 13:30:10 CEST 2001


On Wed, 23 May 2001, Ko-Kang Kevin Wang wrote:

> 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]
> 

> foogoo <- cbind(foo, goo)

or:

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

maybe?

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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