Performs the desired optimization strategies in all the `.R` in a directory. Carefully examine the results after running this function! If several files interact between them (functions from one file use functions from the other), then optimizing all of them together gives more information to rco.

optimize_folder(
  folder,
  optimizers = all_optimizers,
  overwrite = FALSE,
  iterations = Inf,
  pattern = "\\.R$",
  recursive = TRUE
)

Arguments

folder

Path to a directory with files to optimize.

optimizers

A named list of optimizer functions.

overwrite

A logical indicating if files should be overwritten, or saved into new files with "optimized_" prefix.

iterations

Numeric indicating the number of times optimizers should pass. If there was no change after current pass, it will stop.

pattern

An optional regular expression. Only file names which match the regular expression will be optimized.

recursive

A logical value indicating whether or not files in subdirectories of `folder` should be optimized as well.