On Tue, Apr 20, 2004 at 04:25:27PM +0200, Tamas Papp wrote:
> Sorry for not mentioning that, but variables sometimes have different
> names.  I am looking for something like this:
> 
> loadIntoList <- function(file) {
>   load(file)
>   v <- list()
>   ## for each variable name 'i' in ls(), assign 
>   ## v$i <- i
>   ## but I don't know how to write this...  I need help in that.
> }

This might be helpful...

loadIntoList <- function(file) {
  load(file)
  v <- list()
  for (i in ls()) {
      v[[i]] <- eval(as.name(i))
  }
}

The ls() may give you too much, however...

+ seth

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to