From daniel.kaschek at physik.uni-freiburg.de  Tue Feb 24 10:38:27 2015
From: daniel.kaschek at physik.uni-freiburg.de (Daniel Kaschek)
Date: Tue, 24 Feb 2015 10:38:27 +0100
Subject: [Rd] iterated lapply
In-Reply-To: <54EBA17D.7070802@gmail.com>
References: <1424725069.2636.5.camel@physik.uni-freiburg.de>
	<54EBA17D.7070802@gmail.com>
Message-ID: <1424770707.2636.9.camel@physik.uni-freiburg.de>

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



[Rd] iterated lapply
Daniel Kaschek