Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread Rui Barradas
Hello, I believe this solves your problem fun <- function(x){ f <- function(x, n){ if(length(x) < n) x <- c(x, rep(NA, n-length(x))) return(x) } lapply(x, f, max(unlist(lapply(x, length } fun(result) # the 'result' list above

Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 2:28 PM, jim holtman wrote: Is this what you are after: The code below is essentially what I would have imagined to be a method of programming "cbind.data.frame.fill". It's worth noting that either reshape2 or plyr (I don't remember which) offer an rbind version: rbin

Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread jim holtman
Is this what you are after: > more<-c('R is a free software environment for statistical computing', + 'It compiles and runs on a wide variety of UNIX platforms') > result<-strsplit(more,' ') > result [[1]] [1] "R" "is" "a" "free""software" "environme

[R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread Dan Abner
Hello everyone, What is the most efficient & simpliest way to convert all components of a list to separate columns in a matrix? Is there an easy way to programmatically "pad" the length of the resulting shorter character vectors so that they can be easily combined into a data frame? I have the f