-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: create_iso8601 #101
Comments
Hi Ramm, The missing values not being regarded as problems needs fixing... I believe that in one of our meetings it was decided this way... So it was a feature. :) Regarding "28 JAN 2021", look carefully for the difference between my code and yours... And brush up again: https://pharmaverse.github.io/sdtm.oak/articles/iso_8601.html#multiple-alternative-formats. library(sdtm.oak)
date_val <- c(
NA,
"15-Sep-2022",
"17-Feb-21",
"4-Oct-20",
"20-Jan-20",
"UN-UNK-1995",
NA,
"UN-UNK-21",
"26-Jan-20",
"28 Jan 2021",
"12-Feb-20",
"10-UNK-20",
NA,
NA
)
create_iso8601(date_val,
.format = list(c("d-m-y", "d m y")),
.na = c("UN", "UNK"))
#> [1] NA "2022-09-15" "2021-02-17" "2020-10-04" "2020-01-20"
#> [6] "1995" NA "2021" "2020-01-26" "2021-01-28"
#> [11] "2020-02-12" "2020---10" NA NA
problems() Created on 2024-10-25 with reprex v2.1.1 |
|
Issue 1 - My bad, I missed specifying the list as an option in the function call Lets just fix the second one. |
Issue 2: Given that |
What happened?
There are two issues here:
This example does not process the value 28 JAN 2021. When I change the function call to create_iso8601(date_val, .format = c("d-m-y", "dd MMM yyyy"), .na = c("UN", "UNK")), I receive an error: ! Number of vectors in ... should match length of .format.
Missing values are reported as problems.
Expected Behavior:
I should be able to provide more than one format for a vector. As long as the date matches one of the formats, the function should process it.
Missing values should not be reported as problems.
cc - @ramiromagno
Session Information
No response
Reproducible Example
No response
The text was updated successfully, but these errors were encountered: