[R] Bug? using { as a function in lapply

Gabor Grothendieck ggrothendieck at myway.com
Wed Sep 29 01:32:23 CEST 2004


Peter Dalgaard <p.dalgaard <at> biostat.ku.dk> writes:

: 
: Gabor Grothendieck <ggrothendieck <at> myway.com> writes:
: 
: > Peter Dalgaard <p.dalgaard <at> biostat.ku.dk> writes:
: > 
: > : 
: > : Gabor Grothendieck <ggrothendieck <at> myway.com> writes:
: > : 
: > : > Thanks for pointing out that this is already fixed in the upcoming 
: > : > version of R.
: > : 
: > : It isn't. Look closer.
: > : 
: > : I'm not sure this qualifies as a bug though. It boils down to
: > : 
: > : > f <- function(...){...}
: > : > f()
: > : Error in f() : ... used in an incorrect context
: > : 
: > : This doesn't work in S-PLUS either:
: > : 
: > : > f <- function(...){...}
: > : > f()
: > : Problem in f(): "..." may only be used as an argument in a call
: > : Use traceback() to see the call stack
: > : 
: > : But S(-PLUS) doesn't actually have a function "{", it's part of syntax
: > : but not actually put into functions (and if R had better deparsing,
: > : may it could do likewise).
: > 
: > Perhaps that explains why it fails but its not clear to me that this
: > justifies the error, especially when you consider the fact that mapply 
: > got it right.
: 
: mapply doesn't pass "extras" using "...", but uses the MoreArgs list
: instead.

lapply could contain a statement such as:

   moreargs <- list(...)

to reduce it to that case.




More information about the R-help mailing list