From dd3176b3c47c2c589d51557b724946c115502e38 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 29 Aug 2022 15:12:09 +0000 Subject: [PATCH] Updated vignettes (programming strategy and unit test guide) to specify library(tibble) and tribble() rather than tibble::tribble(). --- vignettes/programming_strategy.Rmd | 5 +++-- vignettes/unit_test_guidance.Rmd | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vignettes/programming_strategy.Rmd b/vignettes/programming_strategy.Rmd index 424f68c4..2b12307a 100644 --- a/vignettes/programming_strategy.Rmd +++ b/vignettes/programming_strategy.Rmd @@ -296,8 +296,9 @@ An example is given below: #' @examples #' library(lubridate) #' library(dplyr) +#' library(tibble) #' -#' datain <- tibble::tribble( +#' datain <- tribble( #' ~TRTSDTM, ~ASTDTM, ~AENDT, #' "2014-01-17T23:59:59", "2014-01-18T13:09:O9", "2014-01-20" #' ) %>% @@ -329,7 +330,7 @@ Any newly added variable(-s) should be mentioned here. * `@examples`: A fully self-contained example of how to use the function. Self-contained means that, if this code is executed in a new R session, it will run without errors. That means any packages need to be loaded with `library()` and any datasets needed either to be created directly inside the example code or loaded using `data()`. -If a dataset is created in the example, it should be done so using the function `tibble::tribble()`. +If a dataset is created in the example, it should be done so using the function `tribble()` (specify `library(tibble)` before calling this function). Make sure to align columns as this ensures quick code readability. Copying descriptions should be avoided as it makes the documentation hard to diff --git a/vignettes/unit_test_guidance.Rmd b/vignettes/unit_test_guidance.Rmd index 455e0d00..c307c4f8 100644 --- a/vignettes/unit_test_guidance.Rmd +++ b/vignettes/unit_test_guidance.Rmd @@ -134,7 +134,9 @@ the testing framework used is testthat and has the following format : ``` test_that(" Test 1: ", { - input <- tibble::tribble( + library(tibble) + + input <- tribble( ~inputvar1, ~inputvar2, ... ... @@ -158,7 +160,9 @@ Open the newly created file "test-all_funcs.R" and use the following format: ``` test_that("my_new_func Test 1: ", { - input <- tibble::tribble( + library(tibble) + + input <- tribble( ~inputvar1, ~inputvar2, ... ... @@ -177,7 +181,7 @@ The input and expected output for the unit tests must follow the following rules * Values should be hard-coded whenever possible. * If values need to be derived, only unit tested functions can be used. -If a dataset needs to be created for testing purpose, it should be done so using the function `tibble::tribble()`. +If a dataset needs to be created for testing purpose, it should be done so using the function `tribble()` (specify `library(tibble)` before calling this function). Make sure to align columns as well. This ensures quick code readability. Ensure you give a meaningful explanation of the test in the testthat call, as