tests/testthat/_snaps/utils-round_ids.md

get_round_ids works correctly

Code
  get_round_ids(config_tasks)
Output
  [1] "2022-10-01" "2022-10-08" "2022-10-15" "2022-10-22" "2022-10-29"
Code
  get_round_ids(config_tasks, flatten = "model_task")
Output
  [[1]]
  [1] "2022-10-01" "2022-10-08"

  [[2]]
  [1] "2022-10-15" "2022-10-22" "2022-10-29"
Code
  get_round_ids(config_tasks, flatten = "task_id")
Output
  [[1]]
  [[1]][[1]]
  [1] "2022-10-01" "2022-10-08"


  [[2]]
  [[2]][[1]]
  [1] "2022-10-15" "2022-10-22" "2022-10-29"
Code
  get_round_ids(config_tasks, flatten = "none")
Output
  [[1]]
  [[1]][[1]]
  [[1]][[1]]$required
  NULL

  [[1]][[1]]$optional
  [1] "2022-10-01" "2022-10-08"



  [[2]]
  [[2]][[1]]
  [[2]][[1]]$required
  NULL

  [[2]][[1]]$optional
  [1] "2022-10-15" "2022-10-22" "2022-10-29"
Code
  get_round_ids(config_tasks, flatten = "random")
Condition
  Error in `get_round_ids()`:
  ! `flatten` must be one of "all", "model_task", "task_id", or "none", not "random".
Code
  get_round_ids(config_tasks)
Output
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15" "2022-12-12" "2022-12-19"
  [26] "2022-12-26" "2023-01-02" "2023-01-09" "2023-01-16" "2023-01-23"
  [31] "2023-01-30" "2023-02-06" "2023-02-13" "2023-02-20" "2023-02-27"
  [36] "2023-03-06" "2023-03-13" "2023-03-20" "2023-03-27" "2023-04-03"
  [41] "2023-04-10" "2023-04-17" "2023-04-24" "2023-05-01" "2023-05-08"
  [46] "2023-05-15"
Code
  get_round_ids(config_tasks, flatten = "model_task")
Output
  [[1]]
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15"
Code
  get_round_ids(config_tasks, flatten = "task_id")
Output
  [[1]]
  [[1]][[1]]
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15"

  [[1]][[2]]
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15"
Code
  get_round_ids(config_tasks, flatten = "none")
Output
  [[1]]
  [[1]][[1]]
  [[1]][[1]]$required
  NULL

  [[1]][[1]]$optional
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15"


  [[1]][[2]]
  [[1]][[2]]$required
  NULL

  [[1]][[2]]$optional
   [1] "2022-12-12" "2022-12-19" "2022-12-26" "2023-01-02" "2023-01-09"
   [6] "2023-01-16" "2023-01-23" "2023-01-30" "2023-02-06" "2023-02-13"
  [11] "2023-02-20" "2023-02-27" "2023-03-06" "2023-03-13" "2023-03-20"
  [16] "2023-03-27" "2023-04-03" "2023-04-10" "2023-04-17" "2023-04-24"
  [21] "2023-05-01" "2023-05-08" "2023-05-15"

get_round_idx works correctly

Code
  get_round_idx(config_tasks, "2022-10-01")
Output
  [1] 1
Code
  get_round_idx(config_tasks, "2022-10-29")
Output
  [1] 2
Code
  get_round_idx(config_tasks)
Condition
  Error in `checkmate::assert_string()`:
  ! argument "round_id" is missing, with no default
Code
  get_round_idx(config_tasks, round_id = "2023-01-02")
Output
  [1] 1
Code
  get_round_idx(config_tasks)
Condition
  Error in `checkmate::assert_string()`:
  ! argument "round_id" is missing, with no default


Try the hubUtils package in your browser

Any scripts or data that you put into this service are public.

hubUtils documentation built on Sept. 18, 2024, 5:09 p.m.