Sorry, my mistake, - it works both ways with a correct example and neither way with the wrong example.
k On Thu, Jun 26, 2008 at 4:25 PM, Wacek Kusnierczyk < [EMAIL PROTECTED]> wrote: > >>> sapply(dats,function(x){sapply(x,min)}) > >>> > >> you can achieve the same with > >> > >> sapply(dats, sapply, min) > >> > >> > >> > > Did you actually try it? > > > > > >> dats <- data.frame(1:10,2:11) > >> sapply(dats,sapply,min) > >> > > X1.10 X2.11 > > [1,] 1 2 > > [2,] 2 3 > > [3,] 3 4 > > [4,] 4 5 > > [5,] 5 6 > > [6,] 6 7 > > [7,] 7 8 > > [8,] 8 9 > > [9,] 9 10 > > [10,] 10 11 > > > > Sapply doesn't (or can't?) pass arguments to another sapply -- maybe the > > trick can be done without an anonymous function but not the way you > > suggested. > > > > > > did you actually read the original mail? there dats was a *list* of > data frames. > try this: > > d = data.frame(a=1:10. b=11:20) > l = list(a=d, b=d) > sapply(l, sapply, min) > sapply(l. function(d) sapply(d, min)) > > did you actually read the docs for sapply? there ... stands for > optional arguments to FUN. > try this: > > ?sapply > > > vQ > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.