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 <[EMAIL PROTECTED]> wrote: > 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 Knut > > ______________________________________________ > R-help@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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ R-help@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.