mat_99_run_Rfiles: Run-check files 999 machinery

mat_99_list_RfilesR Documentation

Run-check files 999 machinery

Description

Run-check files 999 machinery

Usage

mat_99_list_Rfiles(
  dir_path = "code_setup",
  no_old = TRUE,
  recursive = FALSE,
  keep_field = NULL
)

mat_list_Rfiles(dir_path, no_old = TRUE, recursive = FALSE)

mat_99_run_Rfiles(
  scripts_file,
  echo = FALSE,
  runMat_true_only = TRUE,
  run_function = c("internal", "external"),
  tmp_dir = NULL
)

mat_run_Rfiles(scripts_file, echo = FALSE)

mat_99_showErr(scripts_file_runned)

mat_99_check_there_update(dir_path = "code_setup", overwrite = TRUE)

mat_99_check_there(dir_path = "code_setup", overwrite = TRUE)

mat_99_write(
  scripts_file_runned,
  dir_path = "code_setup",
  append = NULL,
  cols_extra = NULL
)

mat_99_add_info_last(scripts_file_runned, dir_path = "code_setup", warn = TRUE)

mat_99_arrange_by_last(scripts_file_runned, dir_path = "code_setup")

Arguments

dir_path

directory of files

no_old

Avoid scripts in directory old?

recursive

Look into recursive folders?

keep_field

Additional YAML fields to keep

scripts_file

file of R scripts with path to run, from mat_99_list_Rfiles()

echo

print which file done, and gc?

runMat_true_only

run only the ones with runMat: TRUE

run_function

use either source (internal) or R CMD BATCH (external)

tmp_dir

temporary dir to hold file when using run_function="external"

scripts_file_runned

data from mat_99_run_Rfiles

overwrite

should overwrite data?

append

Overwrite existing or append?

cols_extra

Extra columns to keep

warn

Should it warn if file is actually missing?

Examples

library(matPkg)
library(readr)

## read
path_rscripts <- system.file("r_scripts_fake", package = "matPkg")
path_temp <- tempdir()
dir_dat <- mat_99_list_Rfiles(path_rscripts)
dir_dat

## run
out <- mat_99_run_Rfiles(dir_dat)
out
mat_99_showErr(out)

## save
mat_99_write(out, dir = path_temp)

## check output
read_csv(paste(path_temp, "999_CHECK_RUN_report.csv", sep="/"), col_types = cols())

## re-write
mat_99_write(out, dir = path_temp)
read_csv(paste(path_temp, "999_CHECK_RUN_report.csv", sep="/"), col_types = cols())

## check format
mat_99_check_there_update(path_temp, overwrite=FALSE)
mat_99_check_there_update(path_temp, overwrite=TRUE)

MatthieuStigler/matPkg documentation built on Nov. 13, 2023, 7:53 p.m.