From ggrothendieck at gmail.com  Mon Jul  9 14:41:54 2007
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Mon, 9 Jul 2007 08:41:54 -0400
Subject: [Rd] Problem with {
Message-ID: <971536df0707090541k1e638ed3vd41089af9dd3f83e@mail.gmail.com>

Why does the error get generated here?  Is it a bug?  It seems that
f and "{" are the same but when used in sapply f works but { does not.
Is its use in lapply really "an incorrect context"?

> f <- function(x, y) y
> f(1, 2)
[1] 2
> "{"(1, 2)
[1] 2
> lapply("y", function(x, y) y, 1:4) # ok
[[1]]
[1] 1 2 3 4
> lapply("y", "{", 1:4) # error
Error in lapply("y", "{", 1:4) : '...' used in an incorrect context
> R.version.string # XP
[1] "R version 2.5.1 (2007-06-27)"

See:

https://www.stat.math.ethz.ch/pipermail/r-help/2007-July/135999.html

for a variation of the lapply using sapply (which also has the same
problem if one uses { instead of f).



[Rd] Problem with {
Gabor Grothendieck