From 369795f6c5b1aaa668eec5f08be427d36a6f0dfc Mon Sep 17 00:00:00 2001 From: bms63 Date: Fri, 29 Jul 2022 20:23:23 +0000 Subject: [PATCH] Fixing spelling issues, links, brought in join file --- .github/pull_request_template.md | 2 +- DESCRIPTION | 4 ++-- R/joins.R | 20 ++++++++++++++++++++ README.Rmd | 2 +- inst/WORDLIST | 1 + tests/testthat/test-assertions.R | 22 +++++++++++----------- 6 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 R/joins.R diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a301b41e..c871b5c9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ -Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiral/main/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. +Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiral/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent. Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `devel` branch until you have checked off each task. diff --git a/DESCRIPTION b/DESCRIPTION index 9dffc01a..68e6591e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,8 +18,8 @@ Authors@R: c( ) Description: A toolbox for developers working on (pharmaverse admiral packages, ). Package contains functions that are used internally to admiral and admiral extension packages to - check data, variables and conditions. Package also contains utilitiy functions to help developer with - documentaion, testing and genearl upkeep of admiral and admiral extension packages. + check data, variables and conditions. Package also contains utility functions to help developer with + documentation, testing and general upkeep of admiral and admiral extension packages. License: Apache License (>= 2) URL: https://pharmaverse.github.io/admiraldev, https://github.com/pharmaverse/admiraldev Encoding: UTF-8 diff --git a/R/joins.R b/R/joins.R new file mode 100644 index 00000000..ec0bc9d0 --- /dev/null +++ b/R/joins.R @@ -0,0 +1,20 @@ +anti_join <- function(x, y, by = NULL, copy = FALSE, ...) { + suppress_warning( + dplyr::anti_join(x, y, by = by, copy = copy, ...), + "^Column `.+` has different attributes on LHS and RHS of join$" + ) +} + +inner_join <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...) { + suppress_warning( + dplyr::inner_join(x, y, by = by, copy = copy, suffix = suffix, ...), + "^Column `.+` has different attributes on LHS and RHS of join$" + ) +} + +left_join <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ...) { + suppress_warning( + dplyr::left_join(x, y, by = by, copy = copy, suffix = suffix, ...), + "^Column `.+` has different attributes on LHS and RHS of join$" + ) +} diff --git a/README.Rmd b/README.Rmd index d92b710a..a4fc5159 100644 --- a/README.Rmd +++ b/README.Rmd @@ -61,7 +61,7 @@ remotes::install_github("pharmaverse/admiraldev", ref = "devel") ```{r tree, echo=FALSE} library(fs) -tree <- dir_tree("R",recurse=2) +tree <- dir_tree("R", recurse = 2) ``` ## Keyword/Family diff --git a/inst/WORDLIST b/inst/WORDLIST index 4797fe3a..109227fb 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -31,3 +31,4 @@ pharmaverse renv repo www +th diff --git a/tests/testthat/test-assertions.R b/tests/testthat/test-assertions.R index 1dd06ce4..593e6959 100644 --- a/tests/testthat/test-assertions.R +++ b/tests/testthat/test-assertions.R @@ -2,20 +2,20 @@ library(admiral.test) test_that("Test 1 : `assert_has_variables` an error is thrown if a required variable is missing", { - data(admiral_dm) + data(admiral_dm) - expect_error( - assert_has_variables(admiral_dm, "TRT01P"), - "Required variable `TRT01P` is missing." - ) - }) + expect_error( + assert_has_variables(admiral_dm, "TRT01P"), + "Required variable `TRT01P` is missing." + ) +}) test_that("Test 2 : `assert_has_variables` no error is thrown if a required variable exists", { - data(admiral_dm) + data(admiral_dm) - expect_error(assert_has_variables(admiral_dm, "USUBJID"), NA) - }) + expect_error(assert_has_variables(admiral_dm, "USUBJID"), NA) +}) test_that("Test 3 : `assert_filter_cond` works as expected", { fc <- quo(AGE == 64) @@ -74,7 +74,7 @@ test_that("Test 7 : `assert_data_frame` throws an error if dataframe is grouped" test_that("Test 8 : `assert_character_scalar` throws an error if not a character scaler string", { example_fun2 <- function(msg_type) { msg_type <- assert_character_scalar(msg_type, - values = c("warning", "error"), case_sensitive = FALSE + values = c("warning", "error"), case_sensitive = FALSE ) if (msg_type == "warning") { @@ -87,7 +87,7 @@ test_that("Test 8 : `assert_character_scalar` throws an error if not a character test_that("Test 9 : `assert_character_scalar` throws an error if input is a vector", { example_fun2 <- function(msg_type) { msg_type <- assert_character_scalar(msg_type, - values = c("warning", "error"), case_sensitive = FALSE + values = c("warning", "error"), case_sensitive = FALSE ) if (msg_type == "warning") {