Re: [R] insert new columns to a matrix

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Tue, 24 Jun 2008 08:21:44 -0300

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 <daren76_at_hotmail.com> wrote:

>
> 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 version deleted]]
>
> ______________________________________________
> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


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

Received on Tue 24 Jun 2008 - 11:41:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jun 2008 - 12:30:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive