Hi!
On 03/02/2010 02:22 PM, Nutter, Benjamin wrote:
as.data.frame(t(df))
For example
x<- as.data.frame(t(mtcars))
typeof(x)
[1] "list"
Thanks for the quick reply!
I would never have guessed that as.data.frame() works that way!
BTW
This one seems also to do the trick:
rows.to.list <- function( df ) {
ll<-apply(df,1,list)
ll<-lapply(ll,unlist)
}
It's even a bit faster here.
Bye,
Sebastian
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.