From af6999e3d2de95ee77426d369579295100da3516 Mon Sep 17 00:00:00 2001 From: Ram Ganapathy Date: Wed, 28 Aug 2024 09:44:30 -0700 Subject: [PATCH] [skip vbump] 90 cran comments (#91) * Fix Cran comments * Doubtful fix for CRAN comments. * Add tidyr, remove memoise and clean pkgdown file * Fix typo --------- Co-authored-by: Adam Forys --- DESCRIPTION | 2 +- NAMESPACE | 2 -- R/clear_cache.R | 19 ------------------- R/cnd_df.R | 5 +++++ R/ct.R | 1 - R/dtc_create_iso8601.R | 3 +++ R/pipe.R | 2 ++ R/zzz.R | 3 --- README.md | 28 +++++++++++----------------- _pkgdown.yml | 4 ---- man/clear_cache.Rd | 25 ------------------------- man/create_iso8601.Rd | 3 +++ man/ctl_new_rowid_pillar.cnd_df.Rd | 3 +++ man/dot_pipe.Rd | 3 +++ man/mutate.cnd_df.Rd | 3 +++ man/tbl_sum.cnd_df.Rd | 3 +++ 16 files changed, 37 insertions(+), 72 deletions(-) delete mode 100644 R/clear_cache.R delete mode 100644 R/zzz.R delete mode 100644 man/clear_cache.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 356fd43d..bea09070 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -47,11 +47,11 @@ Imports: admiraldev (>= 1.1.0), dplyr (>= 1.0.0), purrr (>= 1.0.1), + tidyr (>= 1.2.0), rlang (>= 1.0.2), tibble (>= 3.2.0), vctrs (>= 0.5.0), stringr (>= 1.4.0), - memoise (>= 2.0.1), assertthat, pillar, cli diff --git a/NAMESPACE b/NAMESPACE index 613c9be0..2dc0c0f3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,12 +8,10 @@ export("%.>%") export(assign_ct) export(assign_datetime) export(assign_no_ct) -export(clear_cache) export(condition_add) export(create_iso8601) export(ct_map) export(ct_spec_example) -export(ct_spec_vars) export(derive_blfl) export(derive_seq) export(derive_study_day) diff --git a/R/clear_cache.R b/R/clear_cache.R deleted file mode 100644 index 047bd23e..00000000 --- a/R/clear_cache.R +++ /dev/null @@ -1,19 +0,0 @@ -#' Clear `{sdtm.oak}` cache of memoised functions -#' -#' @description -#' Some of `{sdtm.oak}` functions have their results cached for runtime -#' efficiency. Use this function to reset the cache. -#' -#' Memoised functions: -#' - [ct_mappings()] -#' -#' @return Returns a logical value, indicating whether the resetting of the -#' cache was successful (`TRUE`) or not (`FALSE`). -#' -#' @examples -#' clear_cache() -#' -#' @export -clear_cache <- function() { - memoise::forget(ct_mappings) -} diff --git a/R/cnd_df.R b/R/cnd_df.R index 5fcf588d..e8d00f9c 100644 --- a/R/cnd_df.R +++ b/R/cnd_df.R @@ -177,6 +177,8 @@ rm_cnd_df <- function(dat) { #' #' @seealso [ctl_new_rowid_pillar.cnd_df()]. #' +#' @return A character vector with header values of the conditioned data frame. +#' #' @examples #' df <- data.frame(x = c(1L, NA_integer_, 3L)) #' (cnd_df <- condition_add(dat = df, x >= 2L)) @@ -200,6 +202,8 @@ lgl_to_chr <- function(x) { #' @inheritParams pillar::ctl_new_rowid_pillar #' @importFrom pillar ctl_new_rowid_pillar #' +#' @return A character vector to print the tibble which is a conditioned dataframe. +#' #' @seealso [tbl_sum.cnd_df()]. #' #' @export @@ -340,6 +344,7 @@ condition_add <- function(dat, ..., .na = NA, .dat2 = rlang::env()) { #' #' @inheritParams dplyr::mutate #' @importFrom dplyr mutate +#' @return A conditioned data frame, meaning a tibble with mutated values. #' @export mutate.cnd_df <- function(.data, ..., diff --git a/R/ct.R b/R/ct.R index 09027149..06886c98 100644 --- a/R/ct.R +++ b/R/ct.R @@ -14,7 +14,6 @@ #' `"from"` or `"to"`. #' #' @keywords internal -#' @export ct_spec_vars <- function(set = c("all", "ct_clst", "from", "to")) { admiraldev::assert_character_vector(set) diff --git a/R/dtc_create_iso8601.R b/R/dtc_create_iso8601.R index 6ab2a8df..37195b88 100644 --- a/R/dtc_create_iso8601.R +++ b/R/dtc_create_iso8601.R @@ -241,6 +241,9 @@ format_iso8601 <- function(m, .cutoff_2000 = 68L) { #' interpretation of the formats. #' @param .warn Whether to warn about parsing failures. #' +#' @return A vector of dates, times or date-times in [ISO +#' 8601](https://en.wikipedia.org/wiki/ISO_8601) format +#' #' @examples #' # Converting dates #' create_iso8601(c("2020-01-01", "20200102"), .format = "y-m-d") diff --git a/R/pipe.R b/R/pipe.R index 33517d20..a98219fe 100644 --- a/R/pipe.R +++ b/R/pipe.R @@ -47,6 +47,8 @@ #' the dot placeholder, even when piping to the first argument of the #' right-hand side (`rhs`). #' +#' @return No Return Value. +#' #' @examples #' #' # Equivalent to `subset(head(iris), 1:nrow(head(iris)) %% 2 == 0)` diff --git a/R/zzz.R b/R/zzz.R deleted file mode 100644 index e05837ee..00000000 --- a/R/zzz.R +++ /dev/null @@ -1,3 +0,0 @@ -.onLoad <- function(libname, pkgname) { - ct_mappings <<- memoise::memoise(ct_mappings) -} diff --git a/README.md b/README.md index fda5873a..58c78c6c 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,7 @@ status](https://www.r-pkg.org/badges/version/sdtm.oak)](https://CRAN.R-project.org/package=sdtm.oak) -An EDC and Data Standard agnostic solution that enables the -pharmaceutical programming community to develop SDTM datasets in R. The -reusable algorithms concept in `{sdtm.oak}` provides a framework for -modular programming and also can automate SDTM creation based on the -standard SDTM spec. +An EDC (Electronic Data Capture systems) and Data Standard agnostic solution that enables the pharmaceutical programming community to develop CDISC (Clinical Data Interchange Standards Consortium) SDTM (Study Data Tabulation Model) datasets in R. The reusable algorithms concept in 'sdtm.oak' provides a framework for modular programming and also can automate SDTM creation based on the standard SDTM spec. ## Installation @@ -23,7 +19,7 @@ The package is available from CRAN and can be installed with: install.packages("sdtm.oak") ``` -You can install the development version of `{sdtm.oak}` from +You can install the development version of 'sdtm.oak' from [GitHub](https://github.com/pharmaverse/sdtm.oak/) with: ``` r @@ -36,9 +32,7 @@ remotes::install_github("pharmaverse/sdtm.oak") - Raw Data Structure: Data from different EDC systems come in varying structures, with different variable names, dataset names, etc. -- Varying Data Collection Standards: Despite the availability of CDASH, - pharmaceutical companies still create different eCRFs using CDASH - standards. +- Varying Data Collection Standards: Despite the availability of CDASH (Clinical Data Acquisition Standards Harmonization), pharmaceutical companies still create different eCRFs using CDASH standards. Due to the differences in raw data structures and data collection standards, it may seem impossible to develop a common approach for @@ -46,7 +40,7 @@ programming SDTM datasets. ## GOAL -`{sdtm.oak}` aims to address this issue by providing an EDC-agnostic, +'sdtm.oak' aims to address this issue by providing an EDC-agnostic, standards-agnostic solution. It is an open-source R package that offers a framework for the modular programming of SDTM in R. With future releases; it will also strive to automate the creation of SDTM datasets @@ -55,7 +49,7 @@ specifications. ## Scope -Our goal is to use `{sdtm.oak}` to program most of the domains specified +Our goal is to use 'sdtm.oak' to program most of the domains specified in SDTMIG (Study Data Tabulation Model Implementation Guide: Human Clinical Trials) and SDTMIG-AP (Study Data Tabulation Model Implementation Guide: Associated Persons). This R package is based on @@ -64,9 +58,9 @@ carrying out the SDTM mappings for any domains listed in the CDISC SDTMIG and across different versions of SDTM IGs. The design of these functions allows users to specify a raw dataset and a variable name(s) as parameters, making it EDC (Electronic Data Capture) agnostic. As long -as the raw dataset and variable name(s) exist, `{sdtm.oak}` will execute +as the raw dataset and variable name(s) exist, 'sdtm.oak' will execute the SDTM mapping using the selected function. It’s important to note -that `{sdtm.oak}` may not handle sponsor-specific details related to +that 'sdtm.oak' may not handle sponsor-specific details related to managing metadata for LAB tests, unit conversions, and coding information, as many companies have unique business processes. With subsequent releases, strive to automate SDTM creation using a @@ -74,9 +68,9 @@ metadata-driven approach based on a standard SDTM specification format. ## Road Map -This Release: The V0.1.0 release of `{sdtm.oak}` users can create the +This Release: The V0.1.0 release of 'sdtm.oak' users can create the majority of the SDTM domains. Domains that are NOT in scope for the -V0.1.0 release are DM, Trial Design Domains, SV, SE, RELREC, Associated +V0.1.0 release are DM (Demographics), Trial Design Domains, SV (Subject Visits), SE (Subject Elements), RELREC (Related Records), Associated Person domains, and EPOCH Variable across all domains. Subsequent Releases: We are planning to develop the below features in @@ -106,7 +100,7 @@ specification. ## Feedback -We ask users to follow the mentioned approach and try `{sdtm.oak}` to +We ask users to follow the mentioned approach and try 'sdtm.oak' to map any SDTM domains supported in this release. Users can also utilize the test data in the package to become familiar with the concepts before attempting on their own data. Please get in touch with us using one of @@ -118,7 +112,7 @@ the recommended approaches listed below: ## Acknowledgments We thank the contributors and authors of the package. We also thank the -CDISC COSA for sponsoring the `{sdtm.oak}`. Additionally, we would like +CDISC COSA for sponsoring the 'sdtm.oak'. Additionally, we would like to sincerely thank the volunteers from Roche, Pfizer, GSK, Vertex, and Merck for their valuable input as integral members of the CDISC COSA - OAK leadership team. diff --git a/_pkgdown.yml b/_pkgdown.yml index bd1576ea..87f2cb80 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -54,10 +54,6 @@ reference: contents: - "%.>%" -- title: Package global state - contents: - - clear_cache - authors: Ramiro Magno: href: https://www.pattern.institute/team/rmagno/ diff --git a/man/clear_cache.Rd b/man/clear_cache.Rd deleted file mode 100644 index 212f245e..00000000 --- a/man/clear_cache.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clear_cache.R -\name{clear_cache} -\alias{clear_cache} -\title{Clear \code{{sdtm.oak}} cache of memoised functions} -\usage{ -clear_cache() -} -\value{ -Returns a logical value, indicating whether the resetting of the -cache was successful (\code{TRUE}) or not (\code{FALSE}). -} -\description{ -Some of \code{{sdtm.oak}} functions have their results cached for runtime -efficiency. Use this function to reset the cache. - -Memoised functions: -\itemize{ -\item \code{\link[=ct_mappings]{ct_mappings()}} -} -} -\examples{ -clear_cache() - -} diff --git a/man/create_iso8601.Rd b/man/create_iso8601.Rd index b7a69c60..414b20c9 100644 --- a/man/create_iso8601.Rd +++ b/man/create_iso8601.Rd @@ -41,6 +41,9 @@ interpretation of the formats.} \item{.warn}{Whether to warn about parsing failures.} } +\value{ +A vector of dates, times or date-times in \href{https://en.wikipedia.org/wiki/ISO_8601}{ISO 8601} format +} \description{ \code{\link[=create_iso8601]{create_iso8601()}} converts vectors of dates, times or date-times to \href{https://en.wikipedia.org/wiki/ISO_8601}{ISO 8601} format. Learn more in \code{vignette("iso_8601")}. diff --git a/man/ctl_new_rowid_pillar.cnd_df.Rd b/man/ctl_new_rowid_pillar.cnd_df.Rd index eb469be6..59434c0e 100644 --- a/man/ctl_new_rowid_pillar.cnd_df.Rd +++ b/man/ctl_new_rowid_pillar.cnd_df.Rd @@ -15,6 +15,9 @@ \item{...}{These dots are for future extensions and must be empty.} } +\value{ +A character vector to print the tibble which is a conditioned dataframe. +} \description{ Conditioned tibble pillar print method } diff --git a/man/dot_pipe.Rd b/man/dot_pipe.Rd index 716b9fee..74db5fb2 100644 --- a/man/dot_pipe.Rd +++ b/man/dot_pipe.Rd @@ -12,6 +12,9 @@ lhs \%.>\% rhs \item{rhs}{A function call that utilizes the dot (\code{.}) placeholder to specify where \code{lhs} should be placed.} } +\value{ +No Return Value. +} \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} diff --git a/man/mutate.cnd_df.Rd b/man/mutate.cnd_df.Rd index de6ec25a..f198cc61 100644 --- a/man/mutate.cnd_df.Rd +++ b/man/mutate.cnd_df.Rd @@ -49,6 +49,9 @@ variables and columns created by \code{...} are kept. \item{.after}{Control where new columns should appear, i.e. after which columns.} } +\value{ +A conditioned data frame, meaning a tibble with mutated values. +} \description{ \code{\link[=mutate.cnd_df]{mutate.cnd_df()}} is an S3 method to be dispatched by \link[dplyr:mutate]{mutate} generic on conditioned data frames. This function implements a conditional diff --git a/man/tbl_sum.cnd_df.Rd b/man/tbl_sum.cnd_df.Rd index ad009f66..a21154fe 100644 --- a/man/tbl_sum.cnd_df.Rd +++ b/man/tbl_sum.cnd_df.Rd @@ -11,6 +11,9 @@ \item{...}{Additional arguments passed to the default print method.} } +\value{ +A character vector with header values of the conditioned data frame. +} \description{ Conditioned tibble header print method. This S3 method adds an extra line in the header of a tibble that indicates the tibble is a conditioned tibble