Skip to content

Commit

Permalink
Merge branch 'main' into 2126_unify_joined
Browse files Browse the repository at this point in the history
  • Loading branch information
bundfussr committed Oct 10, 2023
2 parents 93d50dc + 6b5e037 commit e316861
Show file tree
Hide file tree
Showing 176 changed files with 1,111 additions and 3,419 deletions.
5 changes: 2 additions & 3 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Set renv profile base on R version.
.get_dependencies <- function(project_dir) {

admdev_loc <- find.package("admiraldev", lib.loc = .libPaths(), quiet = TRUE)
adm_dev_suggests <- if(length(admdev_loc) != 0) {
adm_dev_suggests <- if (length(admdev_loc) != 0) {
renv:::renv_dependencies_discover_description(admdev_loc, fields = c("Depends", "Imports", "LinkingTo", "Suggests"))
} else {
data.frame(Packages = character(0))
Expand All @@ -19,7 +18,7 @@
))
)
)
packages[!(packages %in% c("admiral", "admiraldev", "admiralci", "admiral.test", "pharmaversesdtm", getwd()))]
packages[!(packages %in% c("admiral", "admiraldev", "admiralci", "pharmaversesdtm", getwd()))]
}

options(renv.snapshot.filter = .get_dependencies)
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/4.1/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/4.2/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"",
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'",

"customizations": {
"vscode": {
Expand Down
6 changes: 6 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# move script rstudio into /usr/bin
sudo cp "$(pwd)/.devcontainer/rstudio.sh" /usr/bin/rstudio
sudo chmod +x /usr/bin/rstudio

# Restore renv and install staged dependencies
R -q -e 'renv::restore(lockfile = file.path("renv", "profiles", paste(R.version$major, substr(R.version$minor, 1, 1), sep = "."), "renv.lock")); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = ".", verbose = 1), verbose = 1);'

# Define rstudio default working directory
jq --arg folder "$(pwd)/" '. + { "initial_working_directory": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json
5 changes: 5 additions & 0 deletions .devcontainer/rstudio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

$BROWSER "https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"

exit 1
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Please check off each taskbox as an acknowledgment that you completed the task o
- [ ] Update to all relevant roxygen headers and examples, including keywords and families. Refer to the [categorization of functions](https://pharmaverse.github.io/admiraldev/devel/articles/programming_strategy.html#categorization-of-functions) to tag appropriate keyword/family.
- [ ] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately
- [ ] Address any updates needed for vignettes and/or templates
- [ ] Update `NEWS.md` if the changes pertain to a user-facing function (i.e. it has an `@export` tag) or documentation aimed at users (rather than developers)
- [ ] Update `NEWS.md` under the header `# admiral (development version)` if the changes pertain to a user-facing function (i.e. it has an `@export` tag) or documentation aimed at users (rather than developers)
- [ ] Build admiral site `pkgdown::build_site()` and check that all affected examples are displayed correctly and that all new functions occur on the "[Reference](https://pharmaverse.github.io/admiral/cran-release/reference/index.html)" page.
- [ ] Address or fix all lintr warnings and errors - `lintr::lint_package()`
- [ ] Run `R CMD check` locally and address all errors and warnings - `devtools::check()`
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ on:
- "v*"
branches:
- main
- devel
- patch
- pre-release
# 'pull_request' events are triggered when PRs are
# created against one of these target branches.
pull_request:
branches:
- main
- devel
- patch
- pre-release
# 'release' events are triggered when...
# you guessed it - when releases are made.
release:
Expand Down Expand Up @@ -81,7 +77,7 @@ jobs:
latest-tag-alt-name: cran-release
multiversion-docs-landing-page: cran-release
branches-or-tags-to-list: >-
^cran-release$|^main$|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)$
^cran-release$|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)$
linter:
name: Lint
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: admiral
Type: Package
Title: ADaM in R Asset Library
Version: 0.12.1
Version: 0.12.2.9001
Authors@R: c(
person("Ben", "Straub", email = "[email protected]", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
Expand All @@ -28,7 +28,7 @@ Description: A toolbox for programming Clinical Data Interchange Standards Conso
mandatory part of any New Drug or Biologics License Application submitted to the
United States Food and Drug Administration (FDA). Analysis derivations are
implemented in accordance with the "Analysis Data Model Implementation Guide"
(CDISC Analysis Data Model Team, 2021, <https://www.cdisc.org/standards/foundational/adam/adamig-v1-3-release-package>).
(CDISC Analysis Data Model Team, 2021, <https://www.cdisc.org/standards/foundational/adam>).
Language: en-US
License: Apache License (>= 2)
BugReports: https://github.com/pharmaverse/admiral/issues
Expand All @@ -37,7 +37,7 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Depends: R (>= 3.5)
Depends: R (>= 4.0)
Imports:
admiraldev (>= 0.4.0),
dplyr (>= 0.8.4),
Expand Down
9 changes: 0 additions & 9 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export(derive_param_computed)
export(derive_param_doseint)
export(derive_param_exist_flag)
export(derive_param_exposure)
export(derive_param_extreme_event)
export(derive_param_extreme_record)
export(derive_param_framingham)
export(derive_param_map)
Expand All @@ -84,19 +83,12 @@ export(derive_var_anrind)
export(derive_var_atoxgr)
export(derive_var_atoxgr_dir)
export(derive_var_base)
export(derive_var_basetype)
export(derive_var_chg)
export(derive_var_confirmation_flag)
export(derive_var_dthcaus)
export(derive_var_extreme_dt)
export(derive_var_extreme_dtm)
export(derive_var_extreme_flag)
export(derive_var_joined_exist_flag)
export(derive_var_last_dose_amt)
export(derive_var_last_dose_date)
export(derive_var_last_dose_grp)
export(derive_var_merged_cat)
export(derive_var_merged_character)
export(derive_var_merged_exist_flag)
export(derive_var_merged_summary)
export(derive_var_obs_number)
Expand All @@ -115,7 +107,6 @@ export(derive_vars_dtm_to_tm)
export(derive_vars_duration)
export(derive_vars_dy)
export(derive_vars_joined)
export(derive_vars_last_dose)
export(derive_vars_merged)
export(derive_vars_merged_lookup)
export(derive_vars_period)
Expand Down
51 changes: 51 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
# admiral (development version)

## New Features

## Updates of Existing Functions

- `derive_summary_records()`, `derive_var_merged_summary()`, and `get_summary_records()`
were enhanced such that more than one summary variable can be derived, e.g.,
`AVAL` as the sum and `ADT` as the maximum of the contributing records. (#1792)

## Breaking Changes

- In `derive_summary_records()` and `get_summary_records()` the arguments
`analysis_var` and `summary_fun` were deprecated in favor of `set_values_to`.
(#1792)

- In `derive_var_merged_summary()` the arguments `new_var`, `analysis_var`, and
`summary_fun` were deprecated in favor of `new_vars`. (#1792)

- admiral now only supports R >= 4.0.0

- The following functions, which were deprecated in previous `{admiral}` versions, have been removed: (#2098)
- `derive_param_extreme_event()`
- `derive_vars_last_dose()`
- `derive_var_last_dose_amt()`
- `derive_var_last_dose_date()`
- `derive_var_last_dose_grp()`
- `derive_var_basetype()`
- `derive_var_merged_cat()`
- `derive_var_merged_character()`
- `derive_var_confirmation_flag()`

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

- `compute_egfr(wt)`
- `derive_extreme_records(filter)`
- `derive_param_computed(analysis_value, analysis_var)`
- `derive_var_shift(na_val)`
- `derive_expected_records(dataset_expected_obs)`
- `derive_var_ontrtfl(span_period)`

## Documentation

- A way to standardize roxygen labels and descriptions for function arguments was implemented and tested (#2034)

## Various

# admiral 0.12.2

- A unit test for `derive_param_computed()` was modified in anticipation of major user-facing changes to R version 4.4 (#2147)

# admiral 0.12.1

- `derive_extreme_records()` no longer fails if `dataset_add` is specified and a
Expand Down
2 changes: 1 addition & 1 deletion R/call_derivation.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' Call a single derivation multiple times with some parameters/arguments being fixed across
#' iterations and others varying.
#'
#' @param dataset The input dataset
#' @param dataset `r roxygen_param_dataset()`
#' @param derivation The derivation function to call
#'
#' A function that performs a specific derivation is expected. A derivation
Expand Down
4 changes: 1 addition & 3 deletions R/compute_kidney.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@
compute_egfr <- function(creat, creatu = "SI", age, weight, sex, race = NULL, method, wt) {
### BEGIN DEPRECATION
if (!missing(wt)) {
deprecate_warn("0.12.0", "compute_egfr(old_param = 'wt')", "compute_egfr(new_param = 'weight')")
# old_param is given using exprs()
weight <- wt
deprecate_stop("0.12.0", "compute_egfr(old_param = 'wt')", "compute_egfr(new_param = 'weight')")
}
### END DEPRECATION

Expand Down
6 changes: 2 additions & 4 deletions R/create_single_dose_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,8 @@ dose_freq_lookup <- tribble(
#' necessary when e.g. calculating last dose before an adverse event in `ADAE`
#' or deriving a total dose parameter in `ADEX` when `EXDOSFRQ != ONCE`.
#'
#' @param dataset Input dataset
#'
#' The columns specified by `dose_freq`, `start_date` and the `end_date`
#' parameters are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("dose_freq", "start_date", "end_date"))`
#'
#' @param dose_freq The dose frequency
#'
Expand Down
14 changes: 6 additions & 8 deletions R/derive_adeg_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#'
#' **Note:** This is a wrapper function for the more generic `derive_param_computed()`.
#'
#' @param dataset Input dataset
#'
#' The variables specified by the `by_vars` and the `unit_var` parameter,
#' `PARAMCD`, and `AVAL` are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars", "get_unit_expr"))`
#' `PARAMCD`, and `AVAL` are expected as well.
#'
#' The variable specified by `by_vars` and `PARAMCD` must be a unique key of
#' the input dataset after restricting it by the filter condition (`filter`
Expand Down Expand Up @@ -257,10 +256,9 @@ compute_qtc <- function(qt, rr, method) {
#' The analysis value of the new parameter is derived as
#' \deqn{\frac{60000}{HR}}{60000 / HR}
#'
#' @param dataset Input dataset
#'
#' The variables specified by the `by_vars` parameter, `PARAMCD`, and `AVAL`
#' are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars"))`
#' `PARAMCD`, and `AVAL` are expected as well.
#'
#' The variable specified by `by_vars` and `PARAMCD` must be a unique key of
#' the input dataset after restricting it by the filter condition (`filter`
Expand Down
21 changes: 9 additions & 12 deletions R/derive_advs_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#'
#' **Note:** This is a wrapper function for the more generic `derive_param_computed()`.
#'
#' @param dataset Input dataset
#'
#' The variables specified by the `by_vars` parameter, `PARAMCD`, and
#' `AVAL` are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars"))`
#' `PARAMCD`, and `AVAL` are expected as well.
#'
#' The variable specified by `by_vars` and `PARAMCD` must be a unique key of
#' the input dataset after restricting it by the filter condition (`filter`
Expand Down Expand Up @@ -226,10 +225,9 @@ compute_map <- function(diabp, sysbp, hr = NULL) {
#'
#' **Note:** This is a wrapper function for the more generic `derive_param_computed()`.
#'
#' @param dataset Input dataset
#'
#' The variables specified by the `by_vars` parameter, `PARAMCD`, and
#' `AVAL` are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars"))`
#' `PARAMCD`, and `AVAL` are expected as well.
#'
#' The variable specified by `by_vars` and `PARAMCD` must be a unique key of
#' the input dataset after restricting it by the filter condition (`filter`
Expand Down Expand Up @@ -549,10 +547,9 @@ compute_bsa <- function(height = height,
#'
#' **Note:** This is a wrapper function for the more generic `derive_param_computed()`.
#'
#' @param dataset Input dataset
#'
#' The variables specified by the `by_vars` parameter, `PARAMCD`, and
#' `AVAL` are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars"))`
#' `PARAMCD`, and `AVAL` are expected as well.
#'
#' The variable specified by `by_vars` and `PARAMCD` must be a unique key of
#' the input dataset after restricting it by the filter condition (`filter`
Expand Down
5 changes: 2 additions & 3 deletions R/derive_basetype_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
#' Adds the `BASETYPE` variable to a dataset and duplicates records based upon
#' the provided conditions.
#'
#' @param dataset Input dataset
#'
#' The columns specified in the expressions inside `basetypes` are required.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("basetypes"))`
#'
#' @param basetypes A *named* list of expressions created using the
#' `rlang::exprs()` function
Expand Down
10 changes: 4 additions & 6 deletions R/derive_date_vars.R
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,8 @@ compute_tmf <- function(dtc,
#' impute, we only enable to impute up to a highest level, i.e. you couldn't
#' choose to say impute months, but not days.
#'
#' @param dataset Input dataset.
#'
#' The date character vector (`dtc`) must be present.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("dtc"))`
#'
#' @param new_vars_prefix Prefix used for the output variable(s).
#'
Expand Down Expand Up @@ -1461,9 +1460,8 @@ derive_vars_dt <- function(dataset, # nolint: cyclocomp_linter
#' impute, we only enable to impute up to a highest level, i.e. you couldn't
#' choose to say impute months, but not days.
#'
#' @param dataset Input dataset
#'
#' The date character vector (`dtc`) must be present.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("dtc"))`
#'
#' @param new_vars_prefix Prefix used for the output variable(s).
#'
Expand Down
8 changes: 3 additions & 5 deletions R/derive_expected_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#' Add expected records as new observations for each 'by group' when the dataset
#' contains missing observations.
#'
#' @param dataset Input dataset
#'
#' A data frame, the columns from `dataset_ref` and specified by the
#' `by_vars` parameter are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("dataset_ref", "by_vars"))`
#'
#' @param dataset_expected_obs *Deprecated*, please use `dataset_ref` instead.
#'
Expand Down Expand Up @@ -91,7 +89,7 @@ derive_expected_records <- function(dataset,
by_vars = NULL,
set_values_to = NULL) {
if (!missing(dataset_expected_obs)) {
deprecate_warn(
deprecate_stop(
"0.12.0",
"derive_expected_records(dataset_expected_obs = )",
"derive_expected_records(dataset_ref = )"
Expand Down
Loading

0 comments on commit e316861

Please sign in to comment.