Re: [R] collapsing list to data.frame

2008-03-05 Thread Dimitris Rizopoulos
try this: l <- vector("list", 3) l[[1]] <- list(4, "hello") l[[2]] <- list(7, "world") l[[3]] <- list(9, " ") lis <- lapply(l, "names<-", value = c("V1", "V2")) do.call("rbind", lapply(lis, data.frame, stringsAsFactors = FALSE)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Bio

Re: [R] collapsing list to data.frame

2008-03-05 Thread Erik Iverson
Perhaps data.frame(do.call(rbind, l)) ? - Erik Iverson [EMAIL PROTECTED] wrote: > Hello, > > > Given a list with all elements having identical layout, e.g.: > > > l = NULL > l[[1]] = list(4, "hello") > l[[2]] = list(7, "world") > l[[3]] = list(9, " ") > > > is there an easy way to co

[R] collapsing list to data.frame

2008-03-05 Thread a9804814
Hello, Given a list with all elements having identical layout, e.g.: l = NULL l[[1]] = list(4, "hello") l[[2]] = list(7, "world") l[[3]] = list(9, " ") is there an easy way to collapse this list into a data.frame with each row being the elements of the list ? I.e. in this case I want to