mat_99_run_Rfiles: Run-check files 999 machinery

Description Usage Arguments Examples

Description

Run-check files 999 machinery

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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")
)

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)

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)

scripts_file_runned

data from mat_99_run_Rfiles

overwrite

should overwrite data?

append

Overwrite existing or append?

warn

Should it warn if file is actually missing?

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 Aug. 10, 2021, 11:01 a.m.