diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d0ad77573..a3f8925ca 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: - methods - rlang - stats - - teal.code + - insightsengineering/teal.code - utils - yaml - id: spell-check diff --git a/DESCRIPTION b/DESCRIPTION index b8ad45a86..2c24c8519 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,6 +39,7 @@ Imports: utils Suggests: knitr (>= 1.42), + random.cdisc.data (>= 0.2.1), rmarkdown (>= 2.23), testthat (>= 3.2.2), withr (>= 2.0.0) @@ -51,7 +52,7 @@ Remotes: insightsengineering/teal.code@main Config/Needs/verdepcheck: insightsengineering/teal.code, mllg/checkmate, r-lib/lifecycle, r-lib/rlang, yihui/knitr, rstudio/rmarkdown, - r-lib/testthat, r-lib/withr + insightsengineering/random.cdisc.data, r-lib/testthat, r-lib/withr Config/Needs/website: insightsengineering/nesttemplate Encoding: UTF-8 Language: en-US diff --git a/NEWS.md b/NEWS.md index c0e55fd88..16a3ec140 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ * Print of a `teal_data` object now shows "code (un)verified" instead of "(un)verified teal_data object". +### Miscellaneous + +* Documentation for random `CDISC` datasets was updated and placed in a single man page (#367). + # teal.data 0.7.0 ### Breaking changes diff --git a/R/data.R b/R/data.R index 88d6abea5..6204997e6 100644 --- a/R/data.R +++ b/R/data.R @@ -1,92 +1,108 @@ -#' Random adverse events +#' Simulated `CDISC` Data for Examples #' +#' @description +#' This package contains random datasets that are used for testing purposes in the `teal.data` package: +#' +#' - `rADSL` Random subject-level analysis dataset +#' +#' @name random_cdisc_data +#' @docType data +#' @keywords datasets +#' @source - `rADSL`: [random.cdisc.data::cadsl] +# nolint start: line_length. +#' @format - `rADSL`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADSL)` rows and `r ncol(rADSL)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data +"rADSL" + +#' @description - `rADAE`: Random adverse events analysis dataset #' @docType data -#' @usage rADAE -#' @keywords datasets internal -#' @source internal -#' @name rADAE +#' @keywords datasets +#' @source - `rADAE`: [random.cdisc.data::cadae] +# nolint start: line_length. +#' @format - `rADAE`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADAE)` rows and `r ncol(rADAE)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADAE" -#' Random concomitant medications -#' +#' @description - `rADCM`: Random concomitant medications analysis dataset #' @docType data -#' @usage rADCM -#' @keywords datasets internal -#' @source internal -#' @name rADCM +#' @keywords datasets +#' @source - `rADCM`: [random.cdisc.data::cadcm] +# nolint start: line_length. +#' @format - `rADCM`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADCM)` rows and `r ncol(rADCM)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADCM" -#' Random response -#' -#' Random exposure. -#' +#' @description - `rADEX`: Random response analysis dataset #' @docType data -#' @usage rADEX -#' @keywords datasets internal -#' @source internal -#' @name rADEX +#' @keywords datasets +#' @source - `rADEX`: [random.cdisc.data::cadex] +# nolint start: line_length. +#' @format - `rADEX`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADEX)` rows and `r ncol(rADEX)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADEX" -#' Random lab analysis -#' +#' @description - `rADLB`: Random laboratory data analysis dataset #' @docType data -#' @usage rADLB -#' @keywords datasets internal -#' @source internal -#' @name rADLB +#' @keywords datasets +#' @source - `rADLB`: [random.cdisc.data::cadlb] +# nolint start: line_length. +#' @format - `rADLB`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADLB)` rows and `r ncol(rADLB)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADLB" -#' Random response -#' +#' @description - `rADRS`: Random response analysis dataset #' @docType data -#' @usage rADRS -#' @keywords datasets internal -#' @source internal -#' @name rADRS +#' @keywords datasets +#' @source - `rADRS`: [random.cdisc.data::cadrs] +# nolint start: line_length. +#' @format - `rADRS`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADRS)` rows and `r ncol(rADRS)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADRS" -#' Random patient listing -#' -#' @docType data -#' @usage rADSL -#' @keywords datasets internal -#' @source internal -#' @name rADSL -"rADSL" - -#' Random data `rADTR` -#' +#' @description - `rADTR`: Random tumor response analysis dataset #' @docType data -#' @usage rADTR -#' @keywords datasets internal -#' @source internal -#' @name rADTR +#' @keywords datasets +#' @source - `rADTR`: [random.cdisc.data::cadtr] +# nolint start: line_length. +#' @format - `rADTR`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADTR)` rows and `r ncol(rADTR)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADTR" -#' Random time to event analysis dataset -#' +#' @description - `rADTTE`: Random time to event analysis dataset #' @docType data -#' @usage rADTTE -#' @keywords datasets internal -#' @source internal -#' @name rADTTE +#' @keywords datasets +#' @source - `rADTTE`: [random.cdisc.data::cadtte] +# nolint start: line_length. +#' @format - `rADTTE`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADTTE)` rows and `r ncol(rADTTE)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADTTE" -#' Random data `rADVS` -#' +#' @description - `rADVS`: Random vital signs analysis dataset #' @docType data -#' @usage rADVS -#' @keywords datasets internal -#' @source internal -#' @name rADVS +#' @keywords datasets +#' @source - `rADVS`: [random.cdisc.data::cadvs] +# nolint start: line_length. +#' @format - `rADVS`: An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with `r nrow(rADVS)` rows and `r ncol(rADVS)` columns. +# nolint end: line_length. +#' @rdname random_cdisc_data "rADVS" #' List containing default joining keys for `CDISC` datasets #' -#' This data object is created at loading time from `cdisc_datasets/cdisc_datasets.yaml`. +#' These represent primary and foreign keys for joining `CDISC` datasets. #' -#' @name default_cdisc_join_keys -#' @usage default_cdisc_join_keys #' @docType data -#' @source internal +#' @source internal. See `data-raw/cdisc_datasets.yaml` and `data-raw/data.R` for details. +#' @seealso [join_keys()] +#' @examples +#' default_cdisc_join_keys +#' default_cdisc_join_keys[c("ADSL", "ADAE")] # Subset for ADSL and ADAE "default_cdisc_join_keys" diff --git a/R/dummy_function.R b/R/dummy_function.R index f35cd22b7..6103f2757 100644 --- a/R/dummy_function.R +++ b/R/dummy_function.R @@ -3,9 +3,10 @@ #' Retrieves example CDISC datasets for use in examples and testing. #' #' This function returns a dummy dataset and should only be used within `teal.data`. -#' Note that the datasets are not created and maintained in `teal.data`, they are retrieved its dependencies. +#' Note that the datasets are not created and maintained in `teal.data`, they are retrieved from +#' [`random.cdisc.data`][random.cdisc.data::random.cdisc.data-package] package. #' -#' @param dataname (`character(1)`) name of a CDISC dataset +#' @param dataname (`character(1)`) name of a CDISC dataset. #' #' @return A CDISC dataset as a `data.frame`. #' diff --git a/_pkgdown.yml b/_pkgdown.yml index 70c6032aa..6cb81eb9c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -20,6 +20,7 @@ navbar: href: unit-test-report-non-cran/ github: icon: fa-github + aria-label: View on Github href: https://github.com/insightsengineering/teal.data articles: @@ -56,3 +57,16 @@ reference: - col_labels<- - col_relabel - example_cdisc_data + - title: Built-in datasets + desc: > + Random CDISC synthetic data generated from `{random.cdisc.data}` package. + contents: + - rADSL + - rADAE + - rADLB + - rADCM + - rADEX + - rADRS + - rADTR + - rADTTE + - rADVS diff --git a/data-raw/data.R b/data-raw/data.R index 829b343ee..75f5ba112 100644 --- a/data-raw/data.R +++ b/data-raw/data.R @@ -1,29 +1,29 @@ ## code to prepare `data` for testing examples -rADAE <- random.cdisc.data::cadae # nolint: object_name_linter. +rADAE <- random.cdisc.data::cadae # nolint: object_name. usethis::use_data(rADAE) -rADCM <- random.cdisc.data::cadcm # nolint: object_name_linter. +rADCM <- random.cdisc.data::cadcm # nolint: object_name. usethis::use_data(rADCM) -rADEX <- random.cdisc.data::cadex # nolint: object_name_linter. +rADEX <- random.cdisc.data::cadex # nolint: object_name. usethis::use_data(rADEX) -rADLB <- random.cdisc.data::cadlb # nolint: object_name_linter. +rADLB <- random.cdisc.data::cadlb # nolint: object_name. usethis::use_data(rADLB) -rADRS <- random.cdisc.data::cadrs # nolint: object_name_linter. +rADRS <- random.cdisc.data::cadrs # nolint: object_name. usethis::use_data(rADRS) -rADSL <- random.cdisc.data::cadsl # nolint: object_name_linter. +rADSL <- random.cdisc.data::cadsl # nolint: object_name. usethis::use_data(rADSL) -rADTR <- random.cdisc.data::cadtr # nolint: object_name_linter. +rADTR <- random.cdisc.data::cadtr # nolint: object_name. usethis::use_data(rADTR) -rADTTE <- random.cdisc.data::cadtte # nolint: object_name_linter. +rADTTE <- random.cdisc.data::cadtte # nolint: object_name. usethis::use_data(rADTTE) -rADVS <- random.cdisc.data::cadvs # nolint: object_name_linter. +rADVS <- random.cdisc.data::cadvs # nolint: object_name. usethis::use_data(rADVS) ## Code to prepare default CDISC datasets for `teal.data` diff --git a/inst/WORDLIST b/inst/WORDLIST index c0b8bc658..147bc2b76 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -8,3 +8,4 @@ formatters funder getter pre +un diff --git a/man/default_cdisc_join_keys.Rd b/man/default_cdisc_join_keys.Rd index 266dd9d9c..40a3df933 100644 --- a/man/default_cdisc_join_keys.Rd +++ b/man/default_cdisc_join_keys.Rd @@ -8,12 +8,19 @@ An object of class \code{join_keys} (inherits from \code{list}) of length 19. } \source{ -internal +internal. See \code{data-raw/cdisc_datasets.yaml} and \code{data-raw/data.R} for details. } \usage{ default_cdisc_join_keys } \description{ -This data object is created at loading time from \code{cdisc_datasets/cdisc_datasets.yaml}. +These represent primary and foreign keys for joining \code{CDISC} datasets. +} +\examples{ +default_cdisc_join_keys +default_cdisc_join_keys[c("ADSL", "ADAE")] # Subset for ADSL and ADAE +} +\seealso{ +\code{\link[=join_keys]{join_keys()}} } \keyword{datasets} diff --git a/man/example_cdisc_data.Rd b/man/example_cdisc_data.Rd index 7e268f77b..059e96a1f 100644 --- a/man/example_cdisc_data.Rd +++ b/man/example_cdisc_data.Rd @@ -9,7 +9,7 @@ example_cdisc_data( ) } \arguments{ -\item{dataname}{(\code{character(1)}) name of a CDISC dataset} +\item{dataname}{(\code{character(1)}) name of a CDISC dataset.} } \value{ A CDISC dataset as a \code{data.frame}. @@ -19,5 +19,6 @@ Retrieves example CDISC datasets for use in examples and testing. } \details{ This function returns a dummy dataset and should only be used within \code{teal.data}. -Note that the datasets are not created and maintained in \code{teal.data}, they are retrieved its dependencies. +Note that the datasets are not created and maintained in \code{teal.data}, they are retrieved from +\code{\link[random.cdisc.data:random.cdisc.data-package]{random.cdisc.data}} package. } diff --git a/man/rADAE.Rd b/man/rADAE.Rd deleted file mode 100644 index 6e57b7d7a..000000000 --- a/man/rADAE.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADAE} -\alias{rADAE} -\title{Random adverse events} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 1934 rows and 92 columns. -} -\source{ -internal -} -\usage{ -rADAE -} -\description{ -Random adverse events -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADCM.Rd b/man/rADCM.Rd deleted file mode 100644 index 487916eff..000000000 --- a/man/rADCM.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADCM} -\alias{rADCM} -\title{Random concomitant medications} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3685 rows and 83 columns. -} -\source{ -internal -} -\usage{ -rADCM -} -\description{ -Random concomitant medications -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADEX.Rd b/man/rADEX.Rd deleted file mode 100644 index dbffbce48..000000000 --- a/man/rADEX.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADEX} -\alias{rADEX} -\title{Random response} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 6400 rows and 79 columns. -} -\source{ -internal -} -\usage{ -rADEX -} -\description{ -Random exposure. -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADLB.Rd b/man/rADLB.Rd deleted file mode 100644 index a5430d325..000000000 --- a/man/rADLB.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADLB} -\alias{rADLB} -\title{Random lab analysis} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 8400 rows and 102 columns. -} -\source{ -internal -} -\usage{ -rADLB -} -\description{ -Random lab analysis -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADRS.Rd b/man/rADRS.Rd deleted file mode 100644 index b25c99888..000000000 --- a/man/rADRS.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADRS} -\alias{rADRS} -\title{Random response} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3200 rows and 65 columns. -} -\source{ -internal -} -\usage{ -rADRS -} -\description{ -Random response -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADSL.Rd b/man/rADSL.Rd deleted file mode 100644 index 1b09ee22a..000000000 --- a/man/rADSL.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADSL} -\alias{rADSL} -\title{Random patient listing} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 400 rows and 55 columns. -} -\source{ -internal -} -\usage{ -rADSL -} -\description{ -Random patient listing -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADTR.Rd b/man/rADTR.Rd deleted file mode 100644 index 176308a02..000000000 --- a/man/rADTR.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADTR} -\alias{rADTR} -\title{Random data \code{rADTR}} -\format{ -An object of class \code{data.frame} with 2800 rows and 76 columns. -} -\source{ -internal -} -\usage{ -rADTR -} -\description{ -Random data \code{rADTR} -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADTTE.Rd b/man/rADTTE.Rd deleted file mode 100644 index 185d391d9..000000000 --- a/man/rADTTE.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADTTE} -\alias{rADTTE} -\title{Random time to event analysis dataset} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 2000 rows and 67 columns. -} -\source{ -internal -} -\usage{ -rADTTE -} -\description{ -Random time to event analysis dataset -} -\keyword{datasets} -\keyword{internal} diff --git a/man/rADVS.Rd b/man/rADVS.Rd deleted file mode 100644 index a567f538d..000000000 --- a/man/rADVS.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{rADVS} -\alias{rADVS} -\title{Random data \code{rADVS}} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 16800 rows and 87 columns. -} -\source{ -internal -} -\usage{ -rADVS -} -\description{ -Random data \code{rADVS} -} -\keyword{datasets} -\keyword{internal} diff --git a/man/random_cdisc_data.Rd b/man/random_cdisc_data.Rd new file mode 100644 index 000000000..2cb6efe4e --- /dev/null +++ b/man/random_cdisc_data.Rd @@ -0,0 +1,147 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{random_cdisc_data} +\alias{random_cdisc_data} +\alias{rADSL} +\alias{rADAE} +\alias{rADCM} +\alias{rADEX} +\alias{rADLB} +\alias{rADRS} +\alias{rADTR} +\alias{rADTTE} +\alias{rADVS} +\title{Simulated \code{CDISC} Data for Examples} +\format{ +\itemize{ +\item \code{rADSL}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 400 rows and 55 columns. +} + +\itemize{ +\item \code{rADAE}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 1934 rows and 92 columns. +} + +\itemize{ +\item \code{rADCM}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3685 rows and 83 columns. +} + +\itemize{ +\item \code{rADEX}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 6400 rows and 79 columns. +} + +\itemize{ +\item \code{rADLB}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 8400 rows and 102 columns. +} + +\itemize{ +\item \code{rADRS}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3200 rows and 65 columns. +} + +\itemize{ +\item \code{rADTR}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 2800 rows and 76 columns. +} + +\itemize{ +\item \code{rADTTE}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 2000 rows and 67 columns. +} + +\itemize{ +\item \code{rADVS}: An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 16800 rows and 87 columns. +} +} +\source{ +\itemize{ +\item \code{rADSL}: \link[random.cdisc.data:cadsl]{random.cdisc.data::cadsl} +} + +\itemize{ +\item \code{rADAE}: \link[random.cdisc.data:cadae]{random.cdisc.data::cadae} +} + +\itemize{ +\item \code{rADCM}: \link[random.cdisc.data:cadcm]{random.cdisc.data::cadcm} +} + +\itemize{ +\item \code{rADEX}: \link[random.cdisc.data:cadex]{random.cdisc.data::cadex} +} + +\itemize{ +\item \code{rADLB}: \link[random.cdisc.data:cadlb]{random.cdisc.data::cadlb} +} + +\itemize{ +\item \code{rADRS}: \link[random.cdisc.data:cadrs]{random.cdisc.data::cadrs} +} + +\itemize{ +\item \code{rADTR}: \link[random.cdisc.data:cadtr]{random.cdisc.data::cadtr} +} + +\itemize{ +\item \code{rADTTE}: \link[random.cdisc.data:cadtte]{random.cdisc.data::cadtte} +} + +\itemize{ +\item \code{rADVS}: \link[random.cdisc.data:cadvs]{random.cdisc.data::cadvs} +} +} +\usage{ +rADSL + +rADAE + +rADCM + +rADEX + +rADLB + +rADRS + +rADTR + +rADTTE + +rADVS +} +\description{ +This package contains random datasets that are used for testing purposes in the \code{teal.data} package: +\itemize{ +\item \code{rADSL} Random subject-level analysis dataset +} + +\itemize{ +\item \code{rADAE}: Random adverse events analysis dataset +} + +\itemize{ +\item \code{rADCM}: Random concomitant medications analysis dataset +} + +\itemize{ +\item \code{rADEX}: Random response analysis dataset +} + +\itemize{ +\item \code{rADLB}: Random laboratory data analysis dataset +} + +\itemize{ +\item \code{rADRS}: Random response analysis dataset +} + +\itemize{ +\item \code{rADTR}: Random tumor response analysis dataset +} + +\itemize{ +\item \code{rADTTE}: Random time to event analysis dataset +} + +\itemize{ +\item \code{rADVS}: Random vital signs analysis dataset +} +} +\keyword{datasets}