[R] lapply with argument "X"

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Oct 6 18:31:14 CEST 2004


<john.gavin at ubs.com> writes:

> Hi,
> 
> I am probably making a simple mistake but I can't see it
> 
> > X
> Error: Object "X" not found
> > exists("X")
> [1] FALSE
> > lapply("X", exists)
> [[1]]
> [1] TRUE
> 
> Why is lapply producing true?
> Is it something to do with the first
> argument of lapply also being called 'X'?

Internal variable capture. I think this is a bug.

Also, try  lapply("FUN",get)


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list