Re: [R] insert new columns to a matrix

2008-06-24 Thread Daniel Folkinshteyn
just cbind the cols in the appropriate order: m.2 = cbind( m.1[,1:5], yourthreecolumns, m.1[,6:ncol(m.1)] ) on 06/24/2008 07:02 AM Daren Tan said the following: Instead of prepend or append new columns to a matrix, how to insert them to a matrix ? For example, I would like to insert 3 new column

Re: [R] insert new columns to a matrix

2008-06-24 Thread Henrique Dallazuanna
Try something like this: m <- matrix(1:20, ncol = 5) cbind(m[, 1:3], matrix(1:16, ncol = 4), m[,4:ncol(m)]) On Tue, Jun 24, 2008 at 8:02 AM, Daren Tan <[EMAIL PROTECTED]> wrote: > > Instead of prepend or append new columns to a matrix, how to insert them to > a matrix ? For example, I would like

[R] insert new columns to a matrix

2008-06-24 Thread Daren Tan
Instead of prepend or append new columns to a matrix, how to insert them to a matrix ? For example, I would like to insert 3 new columns after the 5th column of matrix m. _ [[elided Hotmail spam]] [[alternative HTML versio