Skip to content

Commit

Permalink
styler update
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiromagno committed Jan 17, 2024
1 parent 34e70e2 commit 799531d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
21 changes: 12 additions & 9 deletions R/dtc_create_iso8601.R
Original file line number Diff line number Diff line change
Expand Up @@ -431,18 +431,21 @@ create_iso8601 <-

# Check that the `.format` is either a character vector or a list of
# character vectors, and that each string is one of the possible formats.
if (.check_format)
if (.check_format) {
assert_dtc_format(.format)
}

cap_matrices <-
purrr::map2(dots,
.format,
~ parse_dttm(
dttm = .x,
fmt = .y,
na = .na,
fmt_c = .fmt_c
))
purrr::map2(
dots,
.format,
~ parse_dttm(
dttm = .x,
fmt = .y,
na = .na,
fmt_c = .fmt_c
)
)
cap_matrix <- coalesce_capture_matrices(!!!cap_matrices)

iso8601 <- format_iso8601(cap_matrix, .cutoff_2000 = .cutoff_2000)
Expand Down
18 changes: 9 additions & 9 deletions R/dtc_problems.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ any_problems <- function(cap_matrices, .cutoff_2000 = 68L) {
#'
#' @examples
#' dates <-
#' c(
#' "2020-01-01",
#' "2020-02-11",
#' "2020-01-06",
#' "2020-0921",
#' "2020/10/30",
#' "2020-12-05",
#' "20231225"
#' )
#' c(
#' "2020-01-01",
#' "2020-02-11",
#' "2020-01-06",
#' "2020-0921",
#' "2020/10/30",
#' "2020-12-05",
#' "20231225"
#' )
#'
#' #' # By inspecting the problematic dates it can be understood that
#' # the `.format` parameter needs to updated to include other variations.
Expand Down
12 changes: 8 additions & 4 deletions tests/testthat/test-create_iso8601.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ test_that("`create_iso8601()`: expect problems", {
problems = structure(
list(
..i = c(1L, 4L),
..var1 = c("999999999",
"99-12-31"),
..var1 = c(
"999999999",
"99-12-31"
),
..var2 = c("1520", "999999999999")
),
row.names = c(NA,
-2L),
row.names = c(
NA,
-2L
),
class = c("tbl_df", "tbl", "data.frame")
),
class = "iso8601"
Expand Down

0 comments on commit 799531d

Please sign in to comment.