Skip to content

Instantly share code, notes, and snippets.

@cecilialee
Last active June 4, 2020 10:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cecilialee/5d27756105a0ad763fa7d3bd79934006 to your computer and use it in GitHub Desktop.
Save cecilialee/5d27756105a0ad763fa7d3bd79934006 to your computer and use it in GitHub Desktop.
Convert nested list to dataframe in R with plyr. #r
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