[R] lme plot
    Dieter Menne 
    dieter.menne at menne-biomed.de
       
    Fri Mar 24 17:24:00 CET 2006
    
    
  
Peter Dalgaard <p.dalgaard <at> biostat.ku.dk> writes:
> >             alist <- lapply(as.list(allV), as.name)
> >             names(alist) <- allV
> > # next line
> >             alist <- c(as.list(as.name("data.frame")), alist)
> >             mode(alist) <- "call"
> >             data <- eval(alist, sys.parent(1))
> > 
> 
> allV is a vector of variable names (character vector)
> first turn it into a list of R names (a.k.a. symbols)
> then add names to the list identical to the original data
> stick the symbol data.frame at the beginning and convert to call
> 
> This has the net effect that you generate a function call like
> 
>   data.frame(age=age, sex=sex, beauty=beauty)
> 
> finally, you evaluate that call in the parent frame, in which
> presumably age, sex, and beauty will be defined,
I was coming close, but I still don't understand why it fails in  Leonardo's 
example, which I tried to dissect. It not the eval that failed, but the c
(as.list....)
Dieter
    
    
More information about the R-help
mailing list