I had a similar solution by using frequency but having more codes :(

I also like the "recursive" idea : I initially tried to use rapply,
however, which can only take one-arg function.

thanks, everyone.

-w

On 4/24/07, hadley wickham <[EMAIL PROTECTED]> wrote:
> On 4/24/07, Tony Plate <[EMAIL PROTECTED]> wrote:
> > I don't think there's that sort of "apply-reduce" function in R, but for
> > this problem, the last line below happens to be a "one-liner":
>
> Only if you have character data though:
>
> > x <- lapply(1:10, function(i) sample(20, 15))
> > names(which(table(unlist(x))==10))
> [1] "14"
>
> (not that it's hard to turn that back into a number)
>
> Hadley
>


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to