I have a named List of data.frames. I was wondering how to convert the name ("bar1",...,"bar4") of each element List as a column next to each data.frame?
My final desired_output is shown below.
List <- list(bar1=data.frame(study="A",sd = 1), bar2=data.frame(study=c("B","C"),sd=2:3),
bar3=data.frame(study="Z",sd = 4), bar4=data.frame(study="H",sd=5))
# desired_output:
"
study sd id
A 1 bar1
B 2 bar2
C 3 bar2
Z 4 bar3
H 5 bar4
"