Skip to content
Back to formatted view

Raw Message

Message-ID: <428B7E24.2090601@gmail.com>
Date: 2005-05-18T17:40:52Z
From: Muhammad Subianto
Subject: How to convert array to c()
In-Reply-To: <7CBBD627E4E688499349A5D11D07831602ECB886@msgpacpbs.rhq.pac.dfo-mpo.gc.ca>

Dear all,
Many thanks for your help.
Regards,
Muhammad Subianto

On this day 5/18/2005 4:57 PM, Liaw, Andy wrote:
 > Is this what you want?
 >
 >
 >>split(a, row(a))
 >
 > $"1"
 > [1] 1 5 9
 >
 > $"2"
 > [1]  2  6 10
 >
 > $"3"
 > [1]  3  7 11
 >
 > $"4"
 > [1]  4  8 12
 >
 > Andy


On this day 5/18/2005 5:15 PM, OlsenN at pac.dfo-mpo.gc.ca wrote:
> Look at ?assign, one possible answer is shown in the examples.  Modified for
> your example:
> 
> for (i in 1:nrow(a)) {
> 	nam <- paste("r",i, sep=".")
> 	assign(nam, a[i,])
> }
> 
> would give you four separate objects r.1 to r.4 containing the 4 vectors.
> Not sure if that's exactly what you wanted though.
> Norm