[R] data.frame to list

Larry Howe linux at comjet.com
Wed Apr 5 22:00:35 CEST 2006

On Tuesday April 4 2006 21:56, Gabor Grothendieck wrote:
> Try this:
> dd <- read.table(myfile, as.is = TRUE)
> lst <- as.list(dd[,2])
> names(lst) <- dd[,1]
> lst$title

This (almost) works. I did this instead:

p = read.delim("params.txt", as.is=T)
lst = as.list(p[ ,1])
names(lst) = rownames(p)

I know that in some cases column 1 of the data file becomes column 1 of the 
frame, and in other cases it becomes the rownames. I think that is the 

To respond to David Brahms' mail, yes, a hash is what I'm after. I guess my 
perl orientation is evident. And to help all those who come after and may be 
googling for this, I add the following keywords.

like a hash in perl
similar to a perl hash
perl hash in R

That ought to do it. Thanks everyone for your fast and insightful help. 

Larry Howe

More information about the R-help mailing list