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
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
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
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
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
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
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
7 matches
Mail list logo