[Rd] iterated lapply
Daniel Kaschek
daniel.kaschek at physik.uni-freiburg.de
Tue Feb 24 10:38:27 CET 2015
On Mo, 2015-02-23 at 16:54 -0500, Duncan Murdoch wrote:
> This is a feature: it allows you to have arguments that are never
> evaluated, because they are never used, or defaults that depend on
> things that are calculated within the function.
I haven't thought about the thing with the default arguments. That's
really a feature.
Thanks,
Daniel
>
> Duncan Murdoch
>
>
> > conditions <- 1:4
> > test <- lapply(conditions, function(mycondition){
> > #print(mycondition)
> > myfn <- function(i) mycondition*i
> > return(myfn)
> > })
> >
> > sapply(test, function(myfn) myfn(2))
> >
> >
> >
> > Cheers,
> > Daniel
> >
>
--
Daniel Kaschek
Institute of Physics
Freiburg University
Room 210
Phone: +49 761 2038531
More information about the R-devel
mailing list