Re: [R] write data frame in a list

2009-11-10 Thread jim holtman
If you really want a loop, then do: > df=data.frame(x=c(3,6,7),y=c(2,7,4)) > new.list <- list() > for (i in names(df)){ + new.list[[i]] <- df[[i]] + } > > new.list $x [1] 3 6 7 $y [1] 2 7 4 On Tue, Nov 10, 2009 at 8:12 AM, Grzes wrote: > > Thanks jholtman for advice but I need do it us

Re: [R] write data frame in a list

2009-11-10 Thread Grzes
Thanks jholtman for advice but I need do it using a loop. (Because my code is a little more complicated). jholtman wrote: > > Is this what you want: > >> df=data.frame(x=c(3,6,7),y=c(2,7,4)) >> df > x y > 1 3 2 > 2 6 7 > 3 7 4 >> as.list(df) > $x > [1] 3 6 7 > > $y > [1] 2 7 4 > > > On

Re: [R] write data frame in a list

2009-11-10 Thread jim holtman
Is this what you want: > df=data.frame(x=c(3,6,7),y=c(2,7,4)) > df x y 1 3 2 2 6 7 3 7 4 > as.list(df) $x [1] 3 6 7 $y [1] 2 7 4 On Tue, Nov 10, 2009 at 6:05 AM, Grzes wrote: > > Hi, > I have got a data frame: > > df=data.frame(x=c(3,6,7),y=c(2,7,4)) > > and I would like to write my values f