I am struggling to find a proper question for this, so I all ask it myself risking a duplicate
I have extracted the folder structure of my WD and I want to paste the names into a data frame for which each column represents one level of the folder structure.
Using strsplit
I end up with a list of character vectors of which each element represents the name of the folder level. eg.
folders<-list(c("Main") , c("Main","Mid"), c("Main", "Mid", "Sub"))
What would be the easiest way to get a data frame out of this? In this case I would want three columns, but I have several more levels (probably down to six levels)
Expected result (NA could be ""):
data.frame(Level1=c("Main", "Main", "Main"), Level2=c(NA,"Mid", "Mid"),
Level3=c(NA,NA,"Sub"))