Re: [R] list to data frame

2013-08-28 Thread farnoosh sheikhi
Thanks a lot. That worked perfectly.   Best,Farnoosh Sheikhi Sent: Wednesday, August 28, 2013 10:37 AM Subject: Re: list to data frame If the expected result is data.frame()  as.data.frame(t(as.data.frame(lapply(dat1,sum# would be data.frame.  But, not

Re: [R] list to data frame

2013-08-28 Thread arun
Hi, set.seed(249) dat1<- as.data.frame(matrix(sample(1:20,40*20,replace=TRUE),ncol=20)) #Based on your code:  vecNew<-sort(t(as.data.frame(lapply(dat1,sum))),decreasing=TRUE)[1:10] #or vec1<-sort(unlist(lapply(dat1,sum),use.names=FALSE),decreasing=TRUE)[1:10]  identical(vec1,vecNew) #[1] TRUE #

Re: [R] list to data frame

2011-04-10 Thread Philipp Pagel
On Sun, Apr 10, 2011 at 06:01:39PM +, Franklin Tamborello II wrote: > I need to make a data frame out of the data that I currently have in > a list. This works, but is ugly: > ineffData<-rbind(ineffFilesList[[1]], ineffFilesList[[2]], > ineffFilesList[[3]], ineffFilesList[[4]], ineffFilesList[[

Re: [R] list to data frame

2011-04-10 Thread Jorge Ivan Velez
Hi Franklin, Try do.call(rbind, ineffFilesList) See ?do.call for more details. HTH, Jorge On Sun, Apr 10, 2011 at 2:01 PM, Franklin Tamborello II <> wrote: > I need to make a data frame out of the data that I currently have in a > list. This works, but is ugly: > ineffData<-rbind(ineffFilesL

[R] list to data frame

2011-04-10 Thread Franklin Tamborello II
I need to make a data frame out of the data that I currently have in a list. This works, but is ugly: ineffData<-rbind(ineffFilesList[[1]], ineffFilesList[[2]], ineffFilesList[[3]], ineffFilesList[[4]], ineffFilesList[[5]], ineffFilesList[[6]], ineffFilesList[[7]], ineffFilesList[[8]], ineffFile

Re: [R] List to data frame

2010-07-26 Thread Johannes Graumann
Thanks a lot! This solves my problem! Joh On Monday 26 July 2010 17:06:37 Joshua Wiley wrote: > Hi, > > Here is another option if you already have a list you want to convert. > This will handle different elements of the list being different > lengths. > > #Using your example data > mydata <-

Re: [R] List to data frame

2010-07-26 Thread Joshua Wiley
Hi, Here is another option if you already have a list you want to convert. This will handle different elements of the list being different lengths. #Using your example data mydata <- list(c(1,2,3),c(4,5,6)) data.frame( OriginalListIndex = rep(x = seq_along(mydata), times = unlist(lapply(myd

Re: [R] List to data frame

2010-07-26 Thread Henrique Dallazuanna
Try this: stack(data.frame(list('A' = c(1,2,3), 'B' = c(4,5,6 On Mon, Jul 26, 2010 at 11:46 AM, Johannes Graumann < johannes_graum...@web.de> wrote: > Hi, > > Any ideas on how to efficiently convert > > > list(c(1,2,3),c(4,5,6)) > > to > > > data.frame(OriginalListIndex=c(1,1,1,2,2,2),Item=c

[R] List to data frame

2010-07-26 Thread Johannes Graumann
Hi, Any ideas on how to efficiently convert > list(c(1,2,3),c(4,5,6)) to > data.frame(OriginalListIndex=c(1,1,1,2,2,2),Item=c(1,2,3,4,5,6)) Thanks for any hints, Joh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] list to data frame; how to store short elements?

2009-06-09 Thread Jim Porzak
This is programming style, best practices type of question. When converting a list to a data frame (eg to use in ggplot), what is "best" way to store descriptive elements? For example, a survfit object mostly maps to a data frame, but I would also like to carry along the type, call, etc. I'm inc