configuration_info: Convert a list of task configurations into two data.tables of...

Description Usage Arguments Value Examples

Description

Convert a list of task configurations into two data.tables of global and individual features.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
conf_to_dt(
  confs,
  allowed_run_info_cols = c("date_creation", "date_start", "date_end", "priority",
    "status"),
  allow_descr = TRUE,
  allowed_function_cols = c("path", "name"),
  allow_args = TRUE
)

dir_conf_to_dt(
  dir_path,
  allowed_run_info_cols = c("date_creation", "date_start", "date_end", "priority",
    "status"),
  allow_descr = TRUE,
  allowed_function_cols = c("path", "name"),
  allow_args = TRUE
)

Arguments

confs

list of list. List of conf list(s) from yaml file(s).

allowed_run_info_cols

characteror or boolean (c("date_creation", "date_start", "date_end", "priority", "status")). Run info elements to be kept.

allow_descr

boolean or character (TRUE). Either a boolean specifying whether or not to keep descr elements, or column names.

allowed_function_cols

character or boolean (c("names", "path")). Function elements to be kept.

allow_args

boolean or character (TRUE). Either a boolean specifying whether or not to keep args elements, or column names.

dir_path

character. Path to the directory with tasks.

Value

a list of two tables 'tbl_global' and 'tbl_idv':

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
dir_conf <- paste0(tempdir(), "/conf")
dir.create(dir_conf, recursive = TRUE)

# ex fun
fun_path = system.file("ex_fun/sb_fun_ex.R", package = "shinybatch")
fun_name = "sb_fun_ex"

# create 2 confs
conf_1 <- configure_task(dir_path = dir_conf,
                         conf_descr = list(title_1 = "my_title_1",
                                           description_1 = "my_descr_1"),
                         fun_path = fun_path,
                         fun_name = fun_name,
                         fun_args = list(x = 0,
                                         y = 0:4,
                                         z = iris),
                         priority = 1)
conf_2 <- configure_task(dir_path = dir_conf,
                         conf_descr = list(title_2 = "my_title_2",
                                           description_2 = "my_descr_2"),
                         fun_path = fun_path,
                         fun_name = fun_name,
                         fun_args = list(x = 1,
                                         y = 0:4,
                                         z = iris),
                         priority = 2)

# retrieve information about all tasks in main directory
dir_conf_to_dt(dir_conf, allowed_run_info_cols = FALSE)

dir_conf_to_dt(dir_conf,
           allow_descr = FALSE,
           allow_args = FALSE)

dir_conf_to_dt(dir_conf,
           allowed_run_info_cols = c("status", "date_creation"),
           allowed_function_cols = c("path"))

dir_conf_to_dt(dir_conf,
           allowed_run_info_cols = NULL,
           allowed_function_cols = NULL)

dir_conf_to_dt(dir_conf,
           allowed_run_info_cols = "",
           allowed_function_cols = "",
           allow_descr = FALSE,
           allow_args = FALSE)

# or just on some tasks ?
info_conf_1 <- conf_1
info_conf_2 <- yaml::read_yaml(file.path(conf_2$dir, "conf.yml"))

conf_to_dt(list(info_conf_1, info_conf_2))

shinybatch documentation built on June 30, 2021, 9:06 a.m.