Collapse separate simulation files into a single result
This function grabs all .rds
files in the working directory and aggregates them into a single
data.frame
object or combines all the saved results directories and combines them into one.
This is generally useful when results are run piecewise on one node or run independently across
different nodes/computers which are not on the same network.
aggregate_simulations( files = NULL, dirs = NULL, results_dirname = "SimDesign_aggregate_results" )
files |
a |
dirs |
a |
results_dirname |
the new directory to place the aggregated results files |
if files
is used the function returns a data.frame
with the (weighted) average
of the simulation results. Otherwise, if dirs
is used, the function returns NULL
Phil Chalmers rphilip.chalmers@gmail.com
Chalmers, R. P., & Adkins, M. C. (2020). Writing Effective and Reliable Monte Carlo Simulations
with the SimDesign Package. The Quantitative Methods for Psychology, 16
(4), 248-280.
doi: 10.20982/tqmp.16.4.p248
Sigal, M. J., & Chalmers, R. P. (2016). Play it again: Teaching statistics with Monte
Carlo simulation. Journal of Statistics Education, 24
(3), 136-156.
doi: 10.1080/10691898.2016.1246953
## Not run: setwd('my_working_directory') ## run simulations to save the .rds files (or move them to the working directory) # runSimulation(..., filename='file1') # runSimulation(..., filename='file2') final <- aggregate_simulations() saveRDS(final, 'my_final_simulation.rds') # aggregate saved results # runSimulation(..., save_results = TRUE, save_details = list(save_results_dirname = 'dir1')) # runSimulation(..., save_results = TRUE, save_details = list(save_results_dirname = 'dir2')) # place new saved results in 'SimDesign_results/' directory by default aggregate_simulations(dirs = c('dir1', 'dir2')) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.