I have a parallelized foreach loop code in R that generates a list of dataframes. I want to save and append a .csv file in each iteration, in order to get a final .csv files containing the complete list. I know I can take the classical approach and rbind the output generated by foreach to get the dataframe. The problem is that I might run into memory issues since I'm using a big dataframe. I provide some example code:
foreach (l=1:length(list), .packages = c("bio3d",
"rJava",
"rcdk",
"ChemmineR")) %dopar% {
**some code here that generates a df named rmsd from a list**
rmsd <- do.call(rbind, rmsd)
}
I need a fast and safe way to save rmsd in each iteration and append it to a csv named "results-rmsd.csv" without row.names. Thank you very much in advance for your help!
I already tried previous questions related to the same issue (see here) but didn't work for me.