diff --git a/R/cod_structure_input.R b/R/cod_structure_input.R index 6bb6999..792897e 100644 --- a/R/cod_structure_input.R +++ b/R/cod_structure_input.R @@ -19,7 +19,7 @@ #' record identifiers. Default to NULL. If NULL, unique record identifiers #' will be generated. #' -#' @returns A data.frame with 6 columns and number of rows equal to `df` with +#' @returns A tibble with 6 columns and number of rows equal to `df` with #' names `"FreeId"`, `"Sex"`, `"Age Value"`, `"Age Type"`, `"Code"`, and #' `"Death Date"`. #' diff --git a/man/cod_structure.Rd b/man/cod_structure.Rd index 6aa93a2..2dd17f3 100644 --- a/man/cod_structure.Rd +++ b/man/cod_structure.Rd @@ -32,7 +32,7 @@ record identifiers. Default to NULL. If NULL, unique record identifiers will be generated.} } \value{ -A data.frame with 6 columns and number of rows equal to \code{df} with +A tibble with 6 columns and number of rows equal to \code{df} with names \code{"FreeId"}, \code{"Sex"}, \code{"Age Value"}, \code{"Age Type"}, \code{"Code"}, and \code{"Death Date"}. } diff --git a/tests/testthat/test-cod_check_input.R b/tests/testthat/test-cod_check_input.R index 1a3c39e..ef37f92 100644 --- a/tests/testthat/test-cod_check_input.R +++ b/tests/testthat/test-cod_check_input.R @@ -11,4 +11,8 @@ testthat::test_that( "code_check", "code_check_note", "dod_check", "dod_check_note") ) + + expect_warning( + cod_check_codedit_input(icd10_example |> dplyr::select(-FreeId)) + ) }) diff --git a/tests/testthat/test-cod_structure_input.R b/tests/testthat/test-cod_structure_input.R new file mode 100644 index 0000000..765c5cf --- /dev/null +++ b/tests/testthat/test-cod_structure_input.R @@ -0,0 +1,19 @@ +# Tests for cod_structure_input ------------------------------------------------ + +df <- data.frame( + id = 1:3, + sex = c(1, 1, 2), + dob = c("1977-11-05", "1971-04-04", "2012-08-13"), + dod = c("2024-06-28", "2023-10-11", "2023-09-25"), + code = c("P219", "O230", "Q913") +) + + +testthat::test_that( + "cod_structure_input outputs appropriate results", + + expect_s3_class( + cod_structure_input(df, sex = "sex", dob = "dob", dod = "dod", code = "code"), + "tbl" + ) +)