Skip to content

Commit

Permalink
Merge branch 'main' into 2495-restricted_imputed_dtc_dt
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz2101 authored Oct 16, 2024
2 parents 741b8b8 + bf9ffdd commit fb06d52
Show file tree
Hide file tree
Showing 90 changed files with 2,137 additions and 1,347 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
^\.devcontainer$
^vignettes/articles$
^inst/cheatsheet$
^data-raw$
^doc$
50 changes: 50 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check for Snapshot Testing

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
23 changes: 23 additions & 0 deletions .github/workflows/verdepcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Dependency Conformance Test

on:
workflow_dispatch:

jobs:
dependency-test:
strategy:
fail-fast: false
matrix:
test-strategy: ["min_cohort", "min_isolated", "release", "max"]
uses: insightsengineering/r.pkg.template/.github/workflows/verdepcheck.yaml@main
name: Dependency Conformance Test - ${{ matrix.test-strategy }}
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }}
with:
strategy: ${{ matrix.test-strategy }}
additional-env-vars: |
PKG_SYSREQS_DRY_RUN=true
extra-deps: |
lme4 (>= 1.1-35)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ admiral*.tgz
._.DS_Store

.Rprofile
/doc/
/Meta/
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ https://packagemanager.rstudio.com/cran/__linux__/focal/latest
https://raw.githubusercontent.com/pharmaverse/admiral/main/inst/cheatsheet/cheatsheet_image.png
https://rsc.niaid.nih.gov/clinical-research-sites/daids-adverse-event-grading-tables
https://rsc.niaid.nih.gov/sites/default/files/daidsgradingcorrectedv21.pdf
https://www.fda.gov/media/116737/download

14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
Type: Package
Package: admiral
Title: ADaM in R Asset Library
Version: 1.1.1.9004
Version: 1.1.1.9012
Authors@R: c(
person("Ben", "Straub", , "[email protected]", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
person("Stefan", "Bundfuss", role = "aut",
comment = c(ORCID = "0009-0005-0027-1198")),
person("Jeffrey", "Dickinson", role = "aut"),
person("Ross", "Farrugia", role = "aut"),
person("Fanny", "Gautier", role = "aut"),
person("G", "Gayatri", role = "aut"),
person("Asha", "Chakma", role = "aut"),
person("Dinakar", "Kulkarni", role = "aut"),
person("Edoardo", "Mancini", role = "aut"),
person("Edoardo", "Mancini", role = "aut",
comment = c(ORCID = "0009-0006-4899-8641")),
person("Sadchla", "Mascary", role = "aut"),
person("Gordon", "Miller", role = "aut"),
person("Lina", "Patil", role = "aut"),
person("Sophie", "Shapcott", role = "aut"),
person("Eric", "Simms", role = "aut"),
person("Daniel", "Sjoberg", role = "aut"),
person("Stefan", "Thoma", role = "aut"),
person("Daniel", "Sjoberg", role = "aut",
comment = c(ORCID = "0000-0003-0862-2018")),
person("Stefan", "Thoma", role = "aut",
comment = c(ORCID = "0000-0002-5553-9252")),
person("Phillip", "Webster", role = "aut"),
person("Kangjie", "Zhang", role = "aut"),
person("Zelos", "Zhu", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export(derive_var_trtdurd)
export(derive_var_trtemfl)
export(derive_vars_aage)
export(derive_vars_atc)
export(derive_vars_cat)
export(derive_vars_computed)
export(derive_vars_crit_flag)
export(derive_vars_dt)
Expand Down
28 changes: 28 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,38 @@

## New Features

- New function `derive_vars_cat()` for deriving pairs of variables or more, e.g.
`AVALCATx` & `AVALCAxN`. (#2480)
- New function `derive_vars_crit_flag()` for deriving criterion flag variables
(`CRITy`, `CRITyFL`, `CRITyFLN`). (#2468)

- Replace use of `data("sdtm")` with `sdtm <- pharmaverse::sdtm` in templates and vignettes. (#2498)

## Updates of Existing Functions

## Breaking Changes

- The following function arguments are entering the next phase of the deprecation process: (#2487)

### Phase 1 (warning)

### Phase 2 (error)

### Phase 3 (removed)
- `consolidate_metadata(check_keys)`
- Removed at v1.1.1 `compute_egfr(wt)`
- Removed at v1.1.1 `derive_expected_records(dataset_expected_obs)`
- Removed at v1.1.1 `derive_locf_records(dataset_expected_obs)`
- `derive_extreme_event(ignore_event_order)`
- `derive_vars_merged(match_flag)`
- `derive_var_merged_summary(new_var, analysis_var, summary_fun)`
- Removed at v1.1.1 `derive_param_computed(analysis_value, analysis_var)`
- `derive_param_exposure(filter, analysis_var, summary_fun)`
- `derive_summary_records(filter)`
- Removed at v1.1.1 `derive_extreme_records(filter)`
- `derive_var_joined_exist_flag(first_cond, filter)`
- `event_joined(first_cond)`
- `filter_joined(first_cond, filter)`

## Documentation

Expand All @@ -16,6 +42,8 @@
<details>
<summary>Developer Notes</summary>

- Adopted `data-raw/data` R Package Convention (#2427)

</details>

# admiral 1.1.1
Expand Down
25 changes: 0 additions & 25 deletions R/consolidate_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
#'
#' *Permitted Values*: `"none"`, `"message"`, `"warning"`, `"error"`
#'
#' @param check_keys Check keys?
#'
#' `r lifecycle::badge("deprecated")` Please use `check_type` instead.
#'
#' If `"warning"` or `"error"` is specified, a message is issued if the key
#' variables (`key_vars`) are not a unique key in all of the input datasets
#' (`datasets`).
#'
#' *Permitted Values*: `"none"`, `"warning"`, `"error"`
#'
#' @param check_type Check uniqueness?
#'
#' If `"warning"` or `"error"` is specified, a message is issued if the key
Expand Down Expand Up @@ -89,7 +79,6 @@ consolidate_metadata <- function(datasets,
key_vars,
source_var = SOURCE,
check_vars = "warning",
check_keys,
check_type = "error") {
assert_list_of(datasets, cls = "data.frame", named = TRUE)
assert_vars(key_vars)
Expand All @@ -100,20 +89,6 @@ consolidate_metadata <- function(datasets,
values = c("none", "message", "warning", "error"),
case_sensitive = FALSE
)
if (!is_missing(check_keys)) {
deprecate_stop(
"1.1.0",
"consolidate_metadata(check_keys = )",
"consolidate_metadata(check_type = )"
)
check_type <-
assert_character_scalar(
check_keys,
values = c("none", "warning", "error"),
case_sensitive = FALSE,
optional = TRUE
)
}
check_type <-
assert_character_scalar(
check_type,
Expand Down
38 changes: 0 additions & 38 deletions R/derive_extreme_event.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,6 @@
#' A named list of datasets is expected. The `dataset_name` field of `event()`
#' and `event_joined()` refers to the dataset provided in the list.
#'
#' @param ignore_event_order Ignore event order
#'
#' `r lifecycle::badge("deprecated")`
#'
#' This argument is *deprecated*. If event order should be ignored, please
#' specify neither `ignore_event_order` nor `tmp_event_nr_var`. If the event
#' order should be considered, don't specify `ignore_event_order` but specify
#' `tmp_event_nr_var` and and the specified variable to `order`.
#'
#' If the argument is set to `TRUE`, all events defined by `events` are
#' considered equivalent. If there is more than one observation per by group
#' the first or last (with respect to `mode` and `order`) is select without
#' taking the order of the events into account.
#'
#' *Permitted Values:* `TRUE`, `FALSE`
#'
#' @param keep_source_vars Variables to keep from the source dataset
#'
#' For each event the specified variables are kept from the selected
Expand Down Expand Up @@ -353,7 +337,6 @@ derive_extreme_event <- function(dataset = NULL,
order,
mode,
source_datasets = NULL,
ignore_event_order = NULL,
check_type = "warning",
set_values_to = NULL,
keep_source_vars = exprs(everything())) {
Expand Down Expand Up @@ -382,27 +365,6 @@ derive_extreme_event <- function(dataset = NULL,
)
)

if (!is.null(ignore_event_order)) {
if (ignore_event_order) {
deprecate_details <- paste(
"The event order is ignored by default.",
"Please remove `ignore_event_order = TRUE` from the call.",
sep = "\n"
)
} else {
deprecate_details <- c(
"Please remove `ignore_event_order = FALSE` from the call.",
"Specify `tmp_event_nr_var`.",
"Add the specified variable to `order`."
)
}
deprecate_stop(
"1.1.0",
"derive_extreme_event(ignore_event_order=)",
"derive_extreme_event(tmp_event_nr_var=)",
details = deprecate_details
)
}
tmp_event_nr_var <- assert_symbol(enexpr(tmp_event_nr_var), optional = TRUE)
check_type <-
assert_character_scalar(
Expand Down
60 changes: 2 additions & 58 deletions R/derive_merged.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@
#'
#' *Permitted Values*: `"first"`, `"last"`, `NULL`
#'
#' @param match_flag Match flag
#'
#' `r lifecycle::badge("deprecated")` Please use `exist_flag` instead.
#'
#' If the argument is specified (e.g., `match_flag = FLAG`), the specified
#' variable (e.g., `FLAG`) is added to the input dataset. This variable will
#' be `TRUE` for all selected records from `dataset_add` which are merged into
#' the input dataset, and `NA` otherwise.
#'
#' *Permitted Values*: Variable name
#'
#' @param exist_flag Exist flag
#'
#' If the argument is specified (e.g., `exist_flag = FLAG`), the specified
Expand Down Expand Up @@ -321,7 +310,6 @@ derive_vars_merged <- function(dataset,
new_vars = NULL,
filter_add = NULL,
mode = NULL,
match_flag,
exist_flag = NULL,
true_value = "Y",
false_value = NA_character_,
Expand All @@ -344,14 +332,7 @@ derive_vars_merged <- function(dataset,
extract_vars(new_vars)
)
)
if (!is_missing(enexpr(match_flag))) {
deprecate_stop(
"1.1.0",
"derive_vars_merged(match_flag =)",
"derive_vars_merged(exist_flag =)"
)
exist_flag <- assert_symbol(enexpr(match_flag), optional = TRUE)
}

exist_flag <- assert_symbol(enexpr(exist_flag), optional = TRUE)
assert_atomic_vector(true_value, optional = TRUE)
assert_atomic_vector(false_value, optional = TRUE)
Expand Down Expand Up @@ -814,13 +795,6 @@ get_not_mapped <- function() {
#' The variables specified by the `by_vars` and the variables used on the left
#' hand sides of the `new_vars` arguments are expected.
#'
#' @param new_var Variable to add
#'
#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead.
#'
#' The specified variable is added to the input dataset (`dataset`) and set to
#' the summarized values.
#'
#' @param by_vars Grouping variables
#'
#' The expressions on the left hand sides of `new_vars` are evaluated by the
Expand Down Expand Up @@ -855,21 +829,6 @@ get_not_mapped <- function() {
#'
#' *Permitted Values*: a condition
#'
#' @param analysis_var Analysis variable
#'
#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead.
#'
#' The values of the specified variable are summarized by the function
#' specified for `summary_fun`.
#'
#' @param summary_fun Summary function
#'
#' `r lifecycle::badge("deprecated")` Please use `new_vars` instead.
#'
#' The specified function that takes as input `analysis_var` and performs the
#' calculation. This can include built-in functions as well as user defined
#' functions, for example `mean` or `function(x) mean(x, na.rm = TRUE)`.
#'
#' @inheritParams derive_vars_merged
#'
#' @details
Expand Down Expand Up @@ -959,11 +918,8 @@ derive_var_merged_summary <- function(dataset,
dataset_add,
by_vars,
new_vars = NULL,
new_var,
filter_add = NULL,
missing_values = NULL,
analysis_var,
summary_fun) {
missing_values = NULL) {
assert_vars(by_vars)
by_vars_left <- replace_values_by_names(by_vars)
by_vars_right <- chr2vars(paste(vars2chr(by_vars)))
Expand All @@ -980,18 +936,6 @@ derive_var_merged_summary <- function(dataset,
required_vars = expr_c(by_vars_right, extract_vars(new_vars))
)

if (!missing(new_var) || !missing(analysis_var) || !missing(summary_fun)) {
deprecate_stop(
"1.1.0",
I("derive_var_merged_summary(new_var = , anaylsis_var = , summary_fun = )"),
"derive_var_merged_summary(new_vars = )"
)
new_var <- assert_symbol(enexpr(new_var))
analysis_var <- assert_symbol(enexpr(analysis_var))
assert_s3_class(summary_fun, "function")
new_vars <- exprs(!!new_var := {{ summary_fun }}(!!analysis_var), !!!new_vars)
}

# Summarise the analysis value and merge to the original dataset
derive_vars_merged(
dataset,
Expand Down
Loading

0 comments on commit fb06d52

Please sign in to comment.