Skip to content

Commit

Permalink
Merge branch '2143_restrict_derivation_lighten_assertion' of https://…
Browse files Browse the repository at this point in the history
…github.com/pharmaverse/admiral into 2143_restrict_derivation_lighten_assertion
  • Loading branch information
Zelos Zhu committed Oct 10, 2023
2 parents 54dca70 + 159a6be commit b5d91e3
Show file tree
Hide file tree
Showing 141 changed files with 978 additions and 912 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
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
2 changes: 1 addition & 1 deletion 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.2.9000
Version: 0.12.2.9001
Authors@R: c(
person("Ben", "Straub", email = "[email protected]", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@

- `restrict_derivation()` now allows `{dplyr}` functions like `mutate` in the `derivation argument (#2143)

- `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)
Expand All @@ -32,6 +44,8 @@

## Documentation

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

## Various

# admiral 0.12.2
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
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
6 changes: 2 additions & 4 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
10 changes: 9 additions & 1 deletion R/derive_extreme_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' distinguishes `derive_extreme_records()` from `derive_summary_records()`,
#' where only the by variables are populated for the new records.
#'
#' @param dataset Input dataset
#' @param dataset `r roxygen_param_dataset()`
#'
#' If `dataset_add` is not specified, the new records are selected from the
#' input dataset. In this case the variables specified by `by_vars` and
Expand Down Expand Up @@ -92,6 +92,14 @@
#' automatically.
#'
#'
#' @param keep_source_vars Variables to be kept in the new records
#'
#' A named list or tidyselect expressions created by `exprs()` defining the
#' variables to be kept for the new records. The variables specified for
#' `by_vars` and `set_values_to` need not be specified here as they are kept
#' automatically.
#'
#'
#' @inheritParams filter_extreme
#' @inheritParams derive_summary_records
#'
Expand Down
5 changes: 2 additions & 3 deletions R/derive_joined.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
#' variables from both datasets. For example, add the lowest value (nadir)
#' before the current observation.
#'
#' @param dataset Input dataset
#'
#' The variables specified by `by_vars` are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars"))`
#'
#' @param dataset_add Additional dataset
#'
Expand Down
6 changes: 2 additions & 4 deletions R/derive_locf_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#' Adds LOCF records as new observations for each 'by group' when the dataset
#' does not contain observations for missed visits/time points.
#'
#' @param dataset Input dataset
#'
#' The columns specified by the `by_vars`, `analysis_var`, `order`,
#' `keep_vars` parameters are expected.
#' @param dataset
#' `r roxygen_param_dataset(expected_vars = c("by_vars", "analysis_var", "order", "keep_vars"))`
#'
#' @param dataset_expected_obs *Deprecated*, please use `dataset_ref` instead.
#'
Expand Down
Loading

0 comments on commit b5d91e3

Please sign in to comment.