Hi Alberto, I don't think the error is coming from the code you've shown us (although quoting the list names is a little strange).
This works for me: f <- function() { df.a <- data.frame(x=sample(letters, 100, replace=TRUE), y=rnorm(100)) df.b <- data.frame(z=factor(letters), y = factor(1:26)) MyList<- list("a"=df.a, "b"=df.b) return(MyList) } f() Please follow the posting guide, and include a short reproducible example. Best, Ista On Mon, Feb 14, 2011 at 11:57 AM, Alberto Negron <albertoneg...@gmail.com> wrote: > Hi, > > I've got a problem with a function trying to return 2 data frames in a list. > The code is as follow: > > function(x) { > > # code.... > > MyList<- list("a"=df.a,"b"=df.b) > return(MyList) > > } > > and I got the following message: > > Error in list_to_dataframe(res, attr(.data, "split_labels")) : > Results must be all atomic, or all data frames > > At first instance I thought it may be down that both df have same variable > names so I changed var names in df.a - but I am still getting the same error > then I changed my lIst to MyList<- list(df.a,df.b) just to try something > different and still getting the same issue. > > Now I wondering if the error is down to the difference in size for each data > frame df.a (r=500,c=8) and df.b(r=1,c=4) - if this is the case then I don' > know how to fix it. > > Any ideas? > > Sorry, I've got one more question, once I return the list from my function > how can I split out my list to get the original 2 data frames or how can I > access each one independently, i.e. assign them to a data frame again.. if > that makes sense. > > I am using 2.12.1 on Win7 > > Regards, > > Alberto > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org ______________________________________________ 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.