Re: [R] loop with splitted data

2008-09-10 Thread Ling, Gary (Electronic Trading)
help. Thanks in advance, Gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, August 26, 2008 6:27 PM To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] loop with splitted data jim holtman wrote: Is this what you

Re: [R] loop with splitted data

2008-09-10 Thread jim holtman
Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, August 26, 2008 6:27 PM To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] loop with splitted data jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma

Re: [R] loop with splitted data

2008-09-10 Thread Ling, Gary (Electronic Trading)
Subject: Re: [R] loop with splitted data Is this what you want: lapply(z, '[[', 1) [[1]] [1] 1 2 3 [[2]] [1] 11 12 13 lapply(z, '[[', 2) [[1]] [1] 4 5 6 [[2]] [1] 14 15 16 On Wed, Sep 10, 2008 at 11:43 AM, Ling, Gary (Electronic Trading) [EMAIL PROTECTED] wrote: Hi R users, I have

Re: [R] loop with splitted data -solved

2008-08-27 Thread Knut Krueger
Thank you for the hints, finally I was looking for the substitution of splitted$2 to splitted[[as.character(counter)]] I did not know that I can substitute f.e the $2 with [[2]] or/and $y (second column) with [[2]] Knut __ R-help@r-project.org

[R] loop with splitted data

2008-08-26 Thread Knut Krueger
Hi to all, seems to be simple, but I do not find the solution: What must I write for the splitted to get splitted$3$x and splitted$3$x y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) { splitted$x } Regards

Re: [R] loop with splitted data

2008-08-26 Thread jim holtman
Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 On Tue, Aug 26, 2008 at 6:37 AM, Knut Krueger

Re: [R] loop with splitted data

2008-08-26 Thread Peter Dalgaard
jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 But maybe this