I already referred all this post1, post2, post3 etc. So, please don't mark it as duplicate.
As you can see below, my list of lists has 3 levels. (List within a list within a list). Some of the lists doesn't have child list (ex: visits
, procedures
)
I don't know how to create list of lists properly. Hence the screenshot above.
I would like to transform the list of lists to a data frame. However, I am not able to transform it to data frame properly. can you help me, please?
Below is what I tried
df = do.call(rbind, dataFcases) # approach 1
df= as.data.frame(t(as.data.frame(dataFcases))) #approach 2
df <- data.frame(matrix(unlist(dataFcases), nrow=length(dataFcases), byrow=T)) #approach 3
I don't know how to create sample data for 3 levels as I am new to R. Can you please help me convert this to a data frame?