Last active
November 4, 2015 09:33
-
-
Save swayson/62005952d7ed2b834a0c to your computer and use it in GitHub Desktop.
Convert a list of items into a flat dataframe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mylist <- list(structure(list(Hit = "True", Project = "Blue", Year = "2011", | |
Rating = "4", Launch = "26 Jan 2012", ID = "19", Dept = "1, 2, 4"), .Names = c("Hit", | |
"Project", "Year", "Rating", "Launch", "ID", "Dept")), structure(list( | |
Hit = "False", Error = "Record not found"), .Names = c("Hit", | |
"Error")), structure(list(Hit = "True", Project = "Green", Year = "2004", | |
Rating = "8", Launch = "29 Feb 2004", ID = "183", Dept = "6, 8"), .Names = c("Hit", | |
"Project", "Year", "Rating", "Launch", "ID", "Dept"))) | |
dfs <- lapply(mylist, data.frame, stringsAsFactors = FALSE) | |
library(dplyr) | |
rbind_all(dfs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment