From 59f303bb91eaa622bfc3bc63304b057f63862298 Mon Sep 17 00:00:00 2001 From: Jerry Johnson Date: Mon, 6 Nov 2023 12:00:05 +0000 Subject: [PATCH] #2126 unify_joined: improve documentation --- R/derive_extreme_event.R | 4 ++-- R/derive_joined.R | 10 +++++----- R/derive_var_joined_exist_flag.R | 5 ----- man/derive_extreme_event.Rd | 4 ++-- man/derive_var_joined_exist_flag.Rd | 9 ++------- man/derive_vars_joined.Rd | 4 ++-- man/get_joined_data.Rd | 4 ++-- tests/testthat/test-filter_joined.R | 8 ++++---- 8 files changed, 19 insertions(+), 29 deletions(-) diff --git a/R/derive_extreme_event.R b/R/derive_extreme_event.R index 90497d986b..f76febb25a 100644 --- a/R/derive_extreme_event.R +++ b/R/derive_extreme_event.R @@ -39,8 +39,8 @@ #' @param mode Selection mode (first or last) #' #' If a particular event from `events` has more than one observation, -#' "first"/"last" is to select the first/last record of this type of events -#' sorting by `order`. +#' `"first"`/`"last"` is used to select the first/last record of this type of +#' event sorting by `order`. #' #' *Permitted Values:* `"first"`, `"last"` #' diff --git a/R/derive_joined.R b/R/derive_joined.R index a7794638aa..9b38acf24b 100644 --- a/R/derive_joined.R +++ b/R/derive_joined.R @@ -101,7 +101,7 @@ #' not fulfilled for any of the other observations, no observations are #' considered. #' -#' This parameter should be specified if `filter_join` contains summary +#' This argument should be specified if `filter_join` contains summary #' functions which should not apply to all observations but only from a #' certain observation before the current observation up to the current #' observation. For an example see the last example below. @@ -113,7 +113,7 @@ #' condition is not fulfilled for any of the other observations, no #' observations are considered. #' -#' This parameter should be specified if `filter_join` contains summary +#' This argument should be specified if `filter_join` contains summary #' functions which should not apply to all observations but only up to the #' confirmation assessment. For an example see the last example below. #' @@ -669,7 +669,7 @@ derive_vars_joined <- function(dataset, #' not fulfilled for any of the other observations, no observations are #' considered, i.e., the observation is not flagged. #' -#' This parameter should be specified if `filter_join` contains summary +#' This argument should be specified if `filter_join` contains summary #' functions which should not apply to all observations but only from a #' certain observation before the current observation up to the current #' observation. @@ -681,7 +681,7 @@ derive_vars_joined <- function(dataset, #' condition is not fulfilled for any of the other observations, no #' observations are considered, i.e., the observation is not flagged. #' -#' This parameter should be specified if `filter_join` contains summary +#' This argument should be specified if `filter_join` contains summary #' functions which should not apply to all observations but only up to the #' confirmation assessment. #' @@ -751,7 +751,7 @@ get_joined_data <- function(dataset, filter_add = NULL, filter_join = NULL, check_type = "warning") { - # Check input parameters + # Check input arguments assert_vars(by_vars, optional = TRUE) by_vars_left <- replace_values_by_names(by_vars) assert_expr_list(join_vars, optional = TRUE) diff --git a/R/derive_var_joined_exist_flag.R b/R/derive_var_joined_exist_flag.R index ba52cba356..2940cd43c8 100644 --- a/R/derive_var_joined_exist_flag.R +++ b/R/derive_var_joined_exist_flag.R @@ -128,12 +128,8 @@ #' #' @param true_value Value of `new_var` for flagged observations #' -#' *Default*: `"Y"` -#' #' @param false_value Value of `new_var` for observations not flagged #' -#' *Default*: `NA_character_` -#' #' @inheritParams get_joined_data #' #' @details @@ -238,7 +234,6 @@ #' #' @examples #' library(tibble) -#' library(admiral) #' #' # flag observations with a duration longer than 30 and #' # at, after, or up to 7 days before a COVID AE (ACOVFL == "Y") diff --git a/man/derive_extreme_event.Rd b/man/derive_extreme_event.Rd index 729d40c607..17204edfad 100644 --- a/man/derive_extreme_event.Rd +++ b/man/derive_extreme_event.Rd @@ -61,8 +61,8 @@ the event and by group, the records are ordered by the specified order. \item{mode}{Selection mode (first or last) If a particular event from \code{events} has more than one observation, -"first"/"last" is to select the first/last record of this type of events -sorting by \code{order}. +\code{"first"}/\code{"last"} is used to select the first/last record of this type of +event sorting by \code{order}. \emph{Permitted Values:} \code{"first"}, \code{"last"}} diff --git a/man/derive_var_joined_exist_flag.Rd b/man/derive_var_joined_exist_flag.Rd index aeb178b062..acd6905c0f 100644 --- a/man/derive_var_joined_exist_flag.Rd +++ b/man/derive_var_joined_exist_flag.Rd @@ -159,13 +159,9 @@ selects observations with response "CR" and for all observations up to the confirmation observation the response is "CR" or "NE" and there is at most one "NE".} -\item{true_value}{Value of \code{new_var} for flagged observations +\item{true_value}{Value of \code{new_var} for flagged observations} -\emph{Default}: \code{"Y"}} - -\item{false_value}{Value of \code{new_var} for observations not flagged - -\emph{Default}: \code{NA_character_}} +\item{false_value}{Value of \code{new_var} for observations not flagged} \item{check_type}{Check uniqueness? @@ -281,7 +277,6 @@ previous step. For the other observations it is set to \code{false_value}. } \examples{ library(tibble) -library(admiral) # flag observations with a duration longer than 30 and # at, after, or up to 7 days before a COVID AE (ACOVFL == "Y") diff --git a/man/derive_vars_joined.Rd b/man/derive_vars_joined.Rd index ae0c5e3d11..63ccc0a4d7 100644 --- a/man/derive_vars_joined.Rd +++ b/man/derive_vars_joined.Rd @@ -149,7 +149,7 @@ condition is fulfilled up to the current observation. If the condition is not fulfilled for any of the other observations, no observations are considered. -This parameter should be specified if \code{filter_join} contains summary +This argument should be specified if \code{filter_join} contains summary functions which should not apply to all observations but only from a certain observation before the current observation up to the current observation. For an example see the last example below.} @@ -161,7 +161,7 @@ the first observation where the specified condition is fulfilled. If the condition is not fulfilled for any of the other observations, no observations are considered. -This parameter should be specified if \code{filter_join} contains summary +This argument should be specified if \code{filter_join} contains summary functions which should not apply to all observations but only up to the confirmation assessment. For an example see the last example below.} diff --git a/man/get_joined_data.Rd b/man/get_joined_data.Rd index 7cc25bf1bc..b82c96a808 100644 --- a/man/get_joined_data.Rd +++ b/man/get_joined_data.Rd @@ -77,7 +77,7 @@ condition is fulfilled up to the current observation. If the condition is not fulfilled for any of the other observations, no observations are considered, i.e., the observation is not flagged. -This parameter should be specified if \code{filter_join} contains summary +This argument should be specified if \code{filter_join} contains summary functions which should not apply to all observations but only from a certain observation before the current observation up to the current observation.} @@ -89,7 +89,7 @@ the first observation where the specified condition is fulfilled. If the condition is not fulfilled for any of the other observations, no observations are considered, i.e., the observation is not flagged. -This parameter should be specified if \code{filter_join} contains summary +This argument should be specified if \code{filter_join} contains summary functions which should not apply to all observations but only up to the confirmation assessment.} diff --git a/tests/testthat/test-filter_joined.R b/tests/testthat/test-filter_joined.R index 85e6bbc4bd..45d8080cc2 100644 --- a/tests/testthat/test-filter_joined.R +++ b/tests/testthat/test-filter_joined.R @@ -198,8 +198,8 @@ test_that("filter_joined Test 6: deprecation of `first_cond`", { }) # min_cond ---- -## Test 7: test it ---- -test_that("min_cond Test 7: test it", { +## Test 7: minimum is derived correctly ---- +test_that("min_cond Test 7: minimum is derived correctly", { data <- tibble::tribble( ~USUBJID, ~AVISITN, ~AVALC, "1", 1, "PR", @@ -236,8 +236,8 @@ test_that("min_cond Test 7: test it", { }) # max_cond ---- -## Test 8: test it ---- -test_that("max_cond Test 8: test it", { +## Test 8: maximum is derived correctly ---- +test_that("max_cond Test 8: maximum is derived correctly", { data <- tibble::tribble( ~USUBJID, ~AVISITN, ~AVALC, "1", 1, "PR",