diff --git a/DESCRIPTION b/DESCRIPTION index 01cbaa8a..abae0884 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -68,7 +68,8 @@ Suggests: spelling, testthat (>= 3.1.7), DT, - readr + readr, + withr VignetteBuilder: knitr Config/testthat/edition: 3 Config/testthat/parallel: true diff --git a/NAMESPACE b/NAMESPACE index 68d7440d..24f1c45d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,6 +21,8 @@ export(generate_code) export(generate_oak_id_vars) export(hardcode_ct) export(hardcode_no_ct) +export(is_character) +export(is_numeric) export(oak_id_vars) export(problems) export(read_ct_spec) diff --git a/R/generate_code.R b/R/generate_code.R index ad6a3d5e..9af3ecf0 100644 --- a/R/generate_code.R +++ b/R/generate_code.R @@ -75,7 +75,7 @@ is_numeric <- function(var_in) { #' #' @param var_in The variable to check. #' -#' @return +#' @return Logical indicating if the variable is character. #' @export #' is_character <- function(var_in) { @@ -248,10 +248,9 @@ remove_last_pipe <- function(code_blocks) { #' @param spec The specification data frame. #' @param domain The SDTM domain to get the specification for. #' -#' @return +#' @return A tibble with the specification for the domain. #' @keywords internal #' -#' @examples get_domain_spec <- function(spec, domain) { expected_columns <- c( "raw_dataset", diff --git a/R/globals.R b/R/globals.R index 9a2998a0..5297f336 100644 --- a/R/globals.R +++ b/R/globals.R @@ -1,4 +1,6 @@ utils::globalVariables(c( "USUBJID", "VISIT", "dom_dt", "dom_tm", "ref_dt", - "ref_tm" + "ref_tm", "target_sdtm_domain", "target_sdtm_variable", + "mapping_algorithm", "entity_sub_algorithm", "entity_sub_algorithm", + "entity_sub_algorithm_temp", "condition_add_raw_dat", "raw_dataset" )) diff --git a/man/cm_template_prefix.Rd b/man/cm_template_prefix.Rd new file mode 100644 index 00000000..eb244d88 --- /dev/null +++ b/man/cm_template_prefix.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generate_code.R +\docType{data} +\name{cm_template_prefix} +\alias{cm_template_prefix} +\title{The template suffix for the cm code} +\format{ +An object of class \code{glue} (inherits from \code{character}) of length 1. +} +\usage{ +cm_template_prefix +} +\description{ +The template suffix for the cm code +} +\keyword{internal} diff --git a/man/expected_columns.Rd b/man/expected_columns.Rd index f4bdb453..781739d2 100644 --- a/man/expected_columns.Rd +++ b/man/expected_columns.Rd @@ -5,7 +5,7 @@ \alias{expected_columns} \title{Expected columns in the specification file} \format{ -An object of class \code{character} of length 47. +An object of class \code{character} of length 50. } \usage{ expected_columns diff --git a/man/generate_code.Rd b/man/generate_code.Rd index 6efd45e0..ca651ce6 100644 --- a/man/generate_code.Rd +++ b/man/generate_code.Rd @@ -25,7 +25,6 @@ more parameters will be placed on a single line and code will be shorter. See the examples for more details. } \examples{ - \dontrun{ spec <- read_spec("cm_sdtm_oak_spec_cdash.csv") domain <- "cm" diff --git a/man/get_domain_spec.Rd b/man/get_domain_spec.Rd index 976589a6..382c9650 100644 --- a/man/get_domain_spec.Rd +++ b/man/get_domain_spec.Rd @@ -11,6 +11,9 @@ get_domain_spec(spec, domain) \item{domain}{The SDTM domain to get the specification for.} } +\value{ +A tibble with the specification for the domain. +} \description{ Get the specification for a domain and modify it } diff --git a/man/is_character.Rd b/man/is_character.Rd new file mode 100644 index 00000000..3f805162 --- /dev/null +++ b/man/is_character.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generate_code.R +\name{is_character} +\alias{is_character} +\title{Check if a variable is character} +\usage{ +is_character(var_in) +} +\arguments{ +\item{var_in}{The variable to check.} +} +\value{ +Logical indicating if the variable is character. +} +\description{ +Check if a variable is character +} diff --git a/man/is_numeric.Rd b/man/is_numeric.Rd new file mode 100644 index 00000000..18bd359a --- /dev/null +++ b/man/is_numeric.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generate_code.R +\name{is_numeric} +\alias{is_numeric} +\title{Check if a variable is character} +\usage{ +is_numeric(var_in) +} +\arguments{ +\item{var_in}{The variable to check.} +} +\value{ +Logical indicating if the variable is character. +} +\description{ +Check if a variable is character +} diff --git a/man/parse_into_c_call.Rd b/man/parse_into_c_call.Rd new file mode 100644 index 00000000..77340daa --- /dev/null +++ b/man/parse_into_c_call.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generate_code.R +\name{parse_into_c_call} +\alias{parse_into_c_call} +\title{This function converts comma separated string into a character vector} +\usage{ +parse_into_c_call(str_in) +} +\arguments{ +\item{string}{A string with comma separated values.} +} +\value{ +A character vector. +} +\description{ +This function converts comma separated string into a character vector +} +\examples{ +\dontrun{ +str_in <- "a, b, c" +parse_into_c_call("a, b, c") + +str_in <- NA_character_ +parse_into_c_call(str_in) +} + +} +\keyword{internal} diff --git a/man/read_spec.Rd b/man/read_spec.Rd index 4dd18f75..3f4948ad 100644 --- a/man/read_spec.Rd +++ b/man/read_spec.Rd @@ -16,7 +16,6 @@ A tibble with the specification. Read the specification file } \examples{ - \dontrun{ file <- "cm_sdtm_oak_spec_cdash.csv" observed <- read_spec(file)