[R] building a list in loop

Fred J. phddas at yahoo.com
Sat Mar 27 16:04:48 CET 2004


Hello

getdata <- function(p){
fname <- NULL; dl <- list()#build the sturcture
  builddl <- function(q,s){
   fname <<- c(fname,s) #where "s" is a string
   dl <<- list( dl, dt2)
 }
 list(names = fname, data = dl)
}
data <- getdata("c:\somepath")

> data
$names
[1] "fname"

$data
$data[[1]]  <--- since there is no [[1]] how can I
stop 
list()      <--- this from happening? 

$data[[2]]
... lists all rows and cols here

thanks




More information about the R-help mailing list