Re: [R] list to dataframe

2013-05-22 Thread David Winsemius
On May 22, 2013, at 5:00 AM, catalin roibu wrote: > Hello all! > I have a problem to transform this list in a data frame. I try > this command as.data.frame, but unsuccessfully. > Please help me! > > thank you very much! > > structure(list(fns = list(structure(list(r = c(0, 0.048828125, > 0.097

Re: [R] list to dataframe conversion-testing for identical

2012-07-01 Thread arun
Thanks again, A.K.   - Original Message - From: David L Carlson To: 'arun' ; 'R help' Cc: Sent: Sunday, July 1, 2012 5:09 PM Subject: RE: [R] list to dataframe conversion-testing for identical Yes it does have something to do with the representation of floating point numbers.

Re: [R] list to dataframe conversion-testing for identical

2012-07-01 Thread arun
HI All, Thanks for your replies. A.K. - Original Message - From: David Winsemius To: arun Cc: R help Sent: Sunday, July 1, 2012 6:31 PM Subject: Re: [R] list to dataframe conversion-testing for identical On Jul 1, 2012, at 5:09 PM, David L Carlson wrote: > Yes it does h

Re: [R] list to dataframe conversion-testing for identical

2012-07-01 Thread David Winsemius
:3) dat1 <- data.frame(listdat1) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On

Re: [R] list to dataframe conversion-testing for identical

2012-07-01 Thread Rui Barradas
Hello, But > all.equal(dat1,dat2) [1] TRUE So I guess it does have to do with floating-point equality, all.equal uses .Machine$double.eps. (Which could return FALSE on ocasions we would expect TRUE, when, for instance, the tolerance could/should be .Machine$double.eps^0.5.) Rui Barradas E

Re: [R] list to dataframe conversion-testing for identical

2012-07-01 Thread David L Carlson
ation, TX 77843-4352 > -----Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of arun > Sent: Sunday, July 01, 2012 12:56 PM > To: R help > Subject: [R] list to dataframe conversion-testing for identical > > HI

[R] list to dataframe conversion-testing for identical

2012-07-01 Thread arun
HI R help, I was trying to get identical data frame from a list using two methods. #Suppose my list is: listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2)) #Creating dataframe using cbind dat1<-data.frame(do.call("cbind",listdat1)) colnames(dat1)<-c("Var1","Var2","Var3") #Second datafram

Re: [R] List to dataframe

2012-02-08 Thread jim holtman
Does this do what you want: > list <- list(A=1:4, B=1:6, C=1:9) > result <- lapply(names(list), function(x){ + data.frame(name = x + , length = length(list[[x]]) + , gt5 = sum(list[[x]] > 5) + , lt5 = sum(list[[x]] < 5) + ) + }) > do.call(rbind, result) name l

Re: [R] List to dataframe

2012-02-08 Thread Johannes Radinger
Hi, > Try > > list <- list(1:4, 1:6, 1:9) > t(sapply(list, function(x) c(length(x), sum(x > 5), sum(x < 5 > thank you...the sapply approach seems straight forward, although I don't get the names into an own column... When the list elements are named the name is used for the rownames. I'd

Re: [R] List to dataframe

2012-02-08 Thread Jorge I Velez
Try list <- list(1:4, 1:6, 1:9) t(sapply(list, function(x) c(length(x), sum(x > 5), sum(x < 5 HTH, Jorge.- On Wed, Feb 8, 2012 at 8:50 AM, Johannes Radinger <> wrote: > Hi, > I want to "melt" my list and get certain deskriptive factors (length of a > vector etc.) into a dataframe. Best to

[R] List to dataframe

2012-02-08 Thread Johannes Radinger
Hi, I want to "melt" my list and get certain deskriptive factors (length of a vector etc.) into a dataframe. Best to describe it with an example: A <- seq(4) B <- seq(6) C <- seq(9) ls <- list(A,B,C) # this is my list with vectors of different length # thats the dataframe how it should look lik