Skip to content

Commit

Permalink
Closes #426 Removing unneeded dependencies (#431)
Browse files Browse the repository at this point in the history
* removing unneeded dependencies

* Update DESCRIPTION

* Update DESCRIPTION

* Update NEWS.md

* Update test-assertions.R
  • Loading branch information
ddsjoberg authored Apr 17, 2024
1 parent 71a8415 commit 4886b5a
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 60 deletions.
15 changes: 2 additions & 13 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,29 @@ URL: https://pharmaverse.github.io/admiraldev/,
https://github.com/pharmaverse/admiraldev/
BugReports: https://github.com/pharmaverse/admiraldev/issues
Depends:
R (>= 3.5)
R (>= 4.0)
Imports:
cli,
dplyr (>= 1.0.5),
glue (>= 1.6.0),
hms (>= 0.5.3),
lifecycle (>= 0.1.0),
lubridate (>= 1.7.4),
magrittr (>= 1.5),
purrr (>= 0.3.3),
rlang (>= 0.4.4),
stringr (>= 1.4.0),
tidyr (>= 1.0.2),
tidyselect (>= 1.0.0)
Suggests:
covr,
devtools,
diffdf,
DT,
htmltools,
knitr,
lintr,
methods,
miniUI,
pharmaversesdtm,
pkgdown,
rmarkdown,
roxygen2,
rstudioapi,
spelling,
styler,
testthat (>= 3.0.0),
tibble,
usethis
testthat (>= 3.2.0)
VignetteBuilder:
knitr
Config/testthat/edition: 3
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export(warn_if_vars_exist)
export(what_is_it)
importFrom(cli,cli_abort)
importFrom(cli,cli_div)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_cols)
Expand Down Expand Up @@ -98,7 +99,6 @@ importFrom(dplyr,ungroup)
importFrom(dplyr,union)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(hms,as_hms)
importFrom(lifecycle,deprecate_stop)
importFrom(lifecycle,deprecate_warn)
importFrom(lifecycle,deprecated)
Expand All @@ -118,7 +118,6 @@ importFrom(lubridate,weeks)
importFrom(lubridate,years)
importFrom(lubridate,ymd)
importFrom(lubridate,ymd_hms)
importFrom(magrittr,"%>%")
importFrom(purrr,compose)
importFrom(purrr,every)
importFrom(purrr,flatten)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ strategy. (#353)

- The "Release Strategy" vignette now contains a short new "Release Tracking" section linking to an external dashboard for CRAN packages that are awaiting release. (#358)

## Other

- Removed dependencies not needed to build package or package documentation. (#426)

- Increased minimum R version required to 4.0 to match {admiral}. (#382)


# admiraldev 1.0.0

## New Features
Expand Down
4 changes: 1 addition & 3 deletions R/admiraldev-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#' @importFrom dplyr across arrange bind_rows case_when desc ends_with filter
#' full_join group_by if_else mutate n pull rename row_number select slice
#' starts_with transmute ungroup n_distinct union distinct summarise coalesce
#' bind_cols na_if tibble
#' @importFrom magrittr %>%
#' bind_cols na_if tibble %>%
#' @importFrom rlang := abort arg_match as_function as_label as_name as_string
#' call2 caller_env call_name current_env .data enexpr enquo eval_bare
#' eval_tidy expr expr_interp expr_label exprs f_lhs f_rhs is_named inform missing_arg
Expand All @@ -21,7 +20,6 @@
#' time_length %--% ymd ymd_hms weeks years hours minutes
#' @importFrom tidyr drop_na nest pivot_longer pivot_wider unnest
#' @importFrom tidyselect all_of contains vars_select
#' @importFrom hms as_hms
#' @importFrom lifecycle deprecate_warn deprecated deprecate_stop
#' @importFrom cli cli_abort cli_div
#' @importFrom glue glue glue_collapse
Expand Down
9 changes: 5 additions & 4 deletions R/assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#' @family assertion
#'
#' @examples
#' library(tibble)
#' library(dplyr)
#' library(rlang)
#' dm <- tribble(
Expand Down Expand Up @@ -1171,7 +1170,8 @@ assert_function_param <- function(arg, params) {
#' @export
#'
#' @examples
#' library(tibble)
#' library(dplyr)
#'
#' advs <- tribble(
#' ~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
#' "P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
Expand Down Expand Up @@ -1244,7 +1244,8 @@ assert_unit <- function(dataset,
#' @family assertion
#'
#' @examples
#' library(tibble)
#' library(dplyr)
#'
#' advs <- tribble(
#' ~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
#' "P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
Expand Down Expand Up @@ -1732,8 +1733,8 @@ assert_one_to_one <- function(dataset,
#' @keywords assertion
#'
#' @examples
#' library(tibble)
#' library(lubridate)
#' library(dplyr)
#' library(rlang)
#'
#' example_fun <- function(dataset, var) {
Expand Down
1 change: 0 additions & 1 deletion R/expect_dfs_equal.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#'
#' @examples
#' library(dplyr, warn.conflicts = FALSE)
#' library(tibble)
#'
#' tbl1 <- tribble(
#' ~USUBJID, ~AGE, ~SEX,
Expand Down
2 changes: 1 addition & 1 deletion R/process_set_values_to.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @export
#'
#' @examples
#' library(tibble)
#' library(dplyr)
#' data <- tribble(
#' ~AVAL,
#' 20
Expand Down
1 change: 0 additions & 1 deletion man/assert_data_frame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/assert_date_var.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/assert_param_does_not_exist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/assert_unit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/expect_dfs_equal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/process_set_values_to.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions tests/testthat/test-assertions.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# assert_has_variables ----
## Test 1: error if a required variable is missing (deprecation error) ----
test_that("assert_has_variables Test 1: error if a required variable is missing (deprecation error)", { # nolint
data <- tibble::tribble(
data <- dplyr::tribble(
~USUBJID,
"1"
)
Expand All @@ -19,7 +19,7 @@ test_that("assert_has_variables Test 1: error if a required variable is missing

## Test 2: no error if a required variable exists (deprecation error) ----
test_that("assert_has_variables Test 2: no error if a required variable exists (deprecation error)", { # nolint
data <- tibble::tribble(
data <- dplyr::tribble(
~USUBJID,
"1"
)
Expand Down Expand Up @@ -80,7 +80,7 @@ test_that("assert_data_frame Test 4: error if not a dataframe", {

## Test 5: assert_data_frame extract_vars() works as intended ----
test_that("assert_data_frame Test 5: assert_data_frame extract_vars() works as intended", {
input <- tibble::tribble(
input <- dplyr::tribble(
~STUDYID, ~USUBJID, ~SEQ,
"A", "1", 1,
"A", "2", 2,
Expand All @@ -99,7 +99,7 @@ test_that("assert_data_frame Test 5: assert_data_frame extract_vars() works as i

## Test 6: assert_data_frame works if extract_vars() has NULL input ----
test_that("assert_data_frame Test 6: assert_data_frame works if extract_vars() has NULL input", {
input <- tibble::tribble(
input <- dplyr::tribble(
~STUDYID, ~USUBJID, ~SEQ,
"A", "1", 1,
"A", "2", 2,
Expand All @@ -122,7 +122,7 @@ test_that("assert_data_frame Test 7: error if dataframe is grouped", {
assert_data_frame(dataset, required_vars = exprs(STUDYID, USUBJID))
}

data <- tibble::tribble(
data <- dplyr::tribble(
~STUDYID, ~USUBJID, ~ARMCD,
"xyz", "1", "PLACEBO",
"xyz", "2", "ACTIVE"
Expand All @@ -145,7 +145,7 @@ test_that("assert_data_frame Test 8: error if an expected variable is missing",
assert_data_frame(dataset, required_vars = exprs(STUDYID, USUBJID))
}

data <- tibble::tribble(
data <- dplyr::tribble(
~STUDYID, ~ARMCD,
"xyz", "PLACEBO",
"xyz", "ACTIVE"
Expand All @@ -167,7 +167,7 @@ test_that("assert_data_frame Test 9: error if expected variables are missing", {
assert_data_frame(dataset, required_vars = exprs(STUDYID, USUBJID))
}

data <- tibble::tribble(
data <- dplyr::tribble(
~ARMCD,
"PLACEBO",
"ACTIVE"
Expand Down Expand Up @@ -1004,7 +1004,7 @@ test_that("assert_function_param Test 63: error if expected function parameters
# assert_unit ----
## Test 64: no error if the parameter is provided in the expected unit ----
test_that("assert_unit Test 64: no error if the parameter is provided in the expected unit", {
advs <- tibble::tribble(
advs <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
"P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
"P02", "WEIGHT", 85.7, "kg", "WEIGHT", 85.7
Expand All @@ -1017,7 +1017,7 @@ test_that("assert_unit Test 64: no error if the parameter is provided in the exp

## Test 65: error if there are multiple units in the input dataset ----
test_that("assert_unit Test 65: error if there are multiple units in the input dataset", {
advs <- tibble::tribble(
advs <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
"P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
"P02", "WEIGHT", 85.7, "lb", "WEIGHT", 85.7
Expand All @@ -1035,7 +1035,7 @@ test_that("assert_unit Test 65: error if there are multiple units in the input d

## Test 66: error if unexpected unit in the input dataset ----
test_that("assert_unit Test 66: error if unexpected unit in the input dataset", {
advs <- tibble::tribble(
advs <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
"P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
"P02", "WEIGHT", 85.7, "kg", "WEIGHT", 85.7
Expand All @@ -1054,7 +1054,7 @@ test_that("assert_unit Test 66: error if unexpected unit in the input dataset",
# assert_param_does_not_exist ----
## Test 67: error if parameter exists in the input dataset ----
test_that("assert_param_does_not_exist Test 67: error if parameter exists in the input dataset", {
advs <- tibble::tribble(
advs <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
"P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
"P02", "WEIGHT", 85.7, "kg", "WEIGHT", 85.7
Expand All @@ -1073,7 +1073,7 @@ test_that("assert_param_does_not_exist Test 67: error if parameter exists in the

## Test 68: no error if the parameter exists in the dataset ----
test_that("assert_param_does_not_exist Test 68: no error if the parameter exists in the dataset", {
advs <- tibble::tribble(
advs <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
"P01", "WEIGHT", 80.1, "kg", "WEIGHT", 80.1,
"P02", "WEIGHT", 85.7, "kg", "WEIGHT", 85.7
Expand Down Expand Up @@ -1291,7 +1291,7 @@ test_that("assert_one_to_one Test 85: error if there is a many to one mapping",

## Test 86: dataset is returned invisible if one-to-one ----
test_that("assert_one_to_one Test 86: dataset is returned invisible if one-to-one", {
df <- tibble::tribble(
df <- dplyr::tribble(
~SPECIES, ~SPECIESN,
"DOG", 1L,
"CAT", 2L,
Expand All @@ -1313,7 +1313,7 @@ test_that("assert_date_var Test 87: error if variable is not a date or datetime
assert_date_var(dataset = dataset, var = !!var)
}

my_data <- tibble::tribble(
my_data <- dplyr::tribble(
~USUBJID, ~ADT,
"1", ymd("2020-12-06"),
"2", ymd("")
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-dataset_vignette.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("dataset_vignette Test 1: A 'knitr_kable' object is outputted when run
Sys.setenv(IN_PKGDOWN = "false") # nolint: undesirable_function_linter
on.exit(Sys.setenv(IN_PKGDOWN = "")) # nolint: undesirable_function_linter

dm <- tibble::tribble(
dm <- dplyr::tribble(
~STUDYID, ~USUBJID, ~COUNTRY,
"STUDY1", "1", "USA",
"STUDY1", "2", "USA",
Expand All @@ -21,7 +21,7 @@ test_that("dataset_vignette Test 2: A 'shiny.tag.list' is outputted when run ins
Sys.setenv(IN_PKGDOWN = "true") # nolint: undesirable_function_linter
on.exit(Sys.setenv(IN_PKGDOWN = "")) # nolint: undesirable_function_linter

dm <- tibble::tribble(
dm <- dplyr::tribble(
~STUDYID, ~USUBJID, ~COUNTRY,
"STUDY1", "1", "USA",
"STUDY1", "2", "USA",
Expand All @@ -36,7 +36,7 @@ test_that("dataset_vignette Test 2: A 'shiny.tag.list' is outputted when run ins

## Test 3: An error is outputted when calling variable not in dataset ----
test_that("dataset_vignette Test 3: An error is outputted when calling variable not in dataset", {
dm <- tibble::tribble(
dm <- dplyr::tribble(
~STUDYID, ~USUBJID, ~COUNTRY,
"STUDY1", "1", "USA",
"STUDY1", "2", "USA",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-dev_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_that("convert_dtm_to_dtc Test 3: Error is thrown if dtm is not in correct f
# filter_if ----
## Test 4: Input is returned as is if filter is NULL ----
test_that("filter_if Test 4: Input is returned as is if filter is NULL", {
input <- tibble::tribble(
input <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSSTRESN,
"P01", "WEIGHT", 80.9,
"P01", "HEIGHT", 189.2
Expand All @@ -44,7 +44,7 @@ test_that("filter_if Test 4: Input is returned as is if filter is NULL", {

## Test 5: Input is filtered if filter is not NULL ----
test_that("filter_if Test 5: Input is filtered if filter is not NULL", {
input <- tibble::tribble(
input <- dplyr::tribble(
~USUBJID, ~VSTESTCD, ~VSSTRESN,
"P01", "WEIGHT", 80.9,
"P01", "HEIGHT", 189.2
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-get.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# get_constant_vars ----
## Test 1: without ignore_vars ----
test_that("get_constant_vars Test 1: without ignore_vars", {
data <- tibble::tribble(
data <- dplyr::tribble(
~USUBJID, ~AGE, ~AVISIT,
"1", 26, "BASELINE",
"1", 26, "WEEK 1",
Expand All @@ -17,7 +17,7 @@ test_that("get_constant_vars Test 1: without ignore_vars", {

## Test 2: with ignore_vars ----
test_that("get_constant_vars Test 2: with ignore_vars", {
data <- tibble::tribble(
data <- dplyr::tribble(
~USUBJID, ~AGE, ~WGTBL, ~HGTBL, ~AVISIT,
"1", 26, 61, 172, "BASELINE",
"1", 26, 61, 172, "WEEK 1",
Expand Down
Loading

0 comments on commit 4886b5a

Please sign in to comment.