Re: [Rd] Pb with lapply()

2008-02-07 Thread Herve Pages
Thanks Martin for your patient and detailed explanations! So with the base4 solution, base would import base4 so lapply() could call base4::as.list()? Sounds good. Making as.list() a *primitive* function with C-internal S3 and S4 method dispatch: like for length(), etc...? Sounds good too. I'm wo

Re: [Rd] Pb with lapply()

2008-02-01 Thread Martin Maechler
> "HP" == Herve Pages <[EMAIL PROTECTED]> > on Thu, 31 Jan 2008 10:26:31 -0800 writes: HP> Hi, If needed, lapply() tries to convert its first HP> argument into a list before it starts doing something HP> with it: >> lapply HP> function (X, FUN, ...) HP> {

Re: [Rd] Pb with lapply()

2008-02-01 Thread Martin Maechler
> "GaGr" == Gabor Grothendieck <[EMAIL PROTECTED]> > on Thu, 31 Jan 2008 15:44:26 -0500 writes: GaGr> I just checked and the code that previously triggered GaGr> the promises in lists bug seems to work now so I guess GaGr> it is a different problem. *very* different indeed

Re: [Rd] Pb with lapply()

2008-01-31 Thread Gabor Grothendieck
I just checked and the code that previously triggered the promises in lists bug seems to work now so I guess it is a different problem. # code below previously triggered errors but now works # R 2.6.2 (2008-01-26 r44181) on Vista f <- function(x) environment() z <- as.list(f(7)) dput(z) structure(

Re: [Rd] Pb with lapply()

2008-01-31 Thread hpages
Hi Gabor, Quoting Gabor Grothendieck <[EMAIL PROTECTED]>: > The problem of promises not being evaluated in > lists has been discussed before. > > I think its fixed in the development version of R. See > r44139 on Jan 24, 2008 in http://developer.r-project.org/R.svnlog.2007 > I'm using R-devel

Re: [Rd] Pb with lapply()

2008-01-31 Thread Gabor Grothendieck
The problem of promises not being evaluated in lists has been discussed before. I think its fixed in the development version of R. See r44139 on Jan 24, 2008 in http://developer.r-project.org/R.svnlog.2007 On Jan 31, 2008 1:26 PM, <[EMAIL PROTECTED]> wrote: > Hi, > > If needed, lapply() tries to

[Rd] Pb with lapply()

2008-01-31 Thread hpages
Hi, If needed, lapply() tries to convert its first argument into a list before it starts doing something with it: > lapply function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.vector(X) || is.object(X)) X <- as.list(X) .Internal(lapply(X, FUN)) } But in practice,