[R] Want to convert list with vectore of dis similar lengths to data frame

William Dunlap wdunlap at tibco.com
Thu Mar 5 22:03:08 CET 2015

That blog post refers to the authors own function, as.data.frame.list,
that you would have to download from github.  It makes data.frame()
act quite differently than the usual way.  I would not recommend it.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Mar 5, 2015 at 1:53 AM, harini_v <harini.v at positiveintegers.com>

> Hi there
> I am Ms. Harini and I am trying to solve a problem with the function
> data.frame. The problem I am trying to solve is similar to the one listed
> under the title Example Four in this website:
> http://www.r-bloggers.com/converting-a-list-to-a-data-frame/
> For some reason when I try to replicate the results in my R console, I get
> this error:
> test4 <- list('Row1'=letters[1:5], 'Row2'=letters[1:7],
> 'Row3'=letters[8:14])
> as.data.frame(test4)
> Error in data.frame(Row1 = c("a", "b", "c", "d", "e"), Row2 = c("a", "b",
> :
>   arguments imply differing number of rows: 5, 7
> It says that it can’t do what I am asking it to do because the lengths of
> the rows are different. But somehow it has worked on the above website.
> This is an old article (written in 2013). My question is this: Would you
> know if the way data.frame handles lists has been re written in some way? I
> couldn’t find anything to answer my question on the web, so I thought I
> should email you.
> Thank you for the time you are taking to read my email and trying to help
> me.
> Sincerely,
> Harini
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Want-to-convert-list-with-vectore-of-dis-similar-lengths-to-data-frame-tp4704196.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

	[[alternative HTML version deleted]]

More information about the R-help mailing list