Description Usage Arguments Value Author(s) Examples
View source: R/derive_date_vars.R
Convert a date character vector (usually '–DTC') into a Date vector (usually '–DT').
1 2 3 4 5 6 7 | convert_dtc_to_dt(
dtc,
date_imputation = NULL,
min_dates = NULL,
max_dates = NULL,
preserve = FALSE
)
|
dtc |
The –DTC date to convert. A character date is expected in a format like yyyy-mm-dd or yyyy-mm-ddThh:mm:ss. A partial date will return a NA date and a warning will be issued: 'All formats failed to parse. No formats found.'. Note: you can use impute_dtc function to build a complete date. |
date_imputation |
The value to impute the day/month when a datepart is missing. If Otherwise, a character value is expected, either as a
Default is |
min_dates |
Minimum dates A list of dates is expected. It is ensured that the imputed date is not
before any of the specified dates, e.g., that the imputed adverse event start
date is not before the first treatment date. Only dates which are in the
range of possible dates of the impute_dtc( "2020-11", min_dates = list( ymd_hms("2020-12-06T12:12:12"), ymd_hms("2020-11-11T11:11:11") ), date_imputation = "first" ) returns |
max_dates |
Maximum dates A list of dates is expected. It is ensured that the imputed date is not after any of the specified dates, e.g., that the imputed date is not after the data cut off date. Only dates which are in the range of possible dates are considered. |
preserve |
Preserve day if month is missing and day is present For example Permitted Values: Default: |
a date object
Samia Kabi
1 2 | convert_dtc_to_dt("2019-07-18")
convert_dtc_to_dt("2019-07")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.