Last active
June 4, 2020 10:31
-
-
Save cecilialee/5d27756105a0ad763fa7d3bd79934006 to your computer and use it in GitHub Desktop.
Convert nested list to dataframe in R with plyr. #r
This file contains 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
library(plyr) | |
nested_list <- list( | |
a = list( | |
x = 1, | |
y = 2 | |
), | |
b = list( | |
x = 3, | |
y = 4 | |
) | |
) | |
ldply(nested_list, data.frame, .id = "Name") | |
#Name x y | |
#1 a 1 2 | |
#2 b 3 4 | |
# https://stackoverflow.com/questions/39865079/r-convert-nested-list-into-dataframe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment