I got a list of files containing the same xml structure and I have a function, parsing this structure into a dataframe. In pseudocode, what I want to do is the following:
listOfFiles listFiles(diretoryPath)
foreach file in listOfFiles
parse file to dataFrame
and add dataFrame to listOfDataFrames
combine listOfDataFrames to one dataframe
My first approach looked like this:
files<-list.files(path,full.names = TRUE)
dataFrames<-sapply(files,function(file){[...]return dataframe})
finalDataFrame<- rbind(dataFrames)
Which didn't work, since sapply returns a large matrix and not a list of dataframes.
Any good ideas how to do this elegantly in R?