[R] How to convert array to c()
Muhammad Subianto
subianto at gmail.com
Wed May 18 19:40:52 CEST 2005
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
More information about the R-help
mailing list