On Mar 2, 2010, at 8:11 AM, Sebastian Bauer wrote:
Hello,
is there an elegant way, how I can convert each row of a data frame
into distinct elements of a list?
split(dfrm, rownames(dfrm))
In essence, what I'm looking for is something like
rows.to.lists <- function( df ) {
ll <-
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 <- f
roject.org
Subject: [R] Row-wisely converting a data frame into a list
Hello,
is there an elegant way, how I can convert each row of a data frame into
distinct elements of a list?
In essence, what I'm looking for is something like
rows.to.lists <- function( df ) {
ll <-
Hello,
is there an elegant way, how I can convert each row of a data frame into
distinct elements of a list?
In essence, what I'm looking for is something like
rows.to.lists <- function( df ) {
ll <- NULL
for( i in 1:nrow(df) )
ll <- append( ll, list(df[i,]) )
4 matches
Mail list logo