View source: R/derive_vars_dt_dtm_utils.R
| get_imputation_target_date | R Documentation |
Get Date Imputation Targets
get_imputation_target_date(date_imputation, month)
date_imputation |
The value to impute the day/month when a datepart is missing. A character value is expected, either as a
|
month |
Month component of the partial date
|
For date_imputation = "first" "0000", "01", "01" are returned.
For date_imputation = "mid" "xxxx", "06", "30" if month is NA.
otherwise "15" returned.
For date_imputation = "last" "9999", "12", "28" are returned.
For date_imputation = "<mm>-<dd>" "xxxx", "<mm>", "<dd>" are returned.
"xxxx" indicates that the component is undefined. If an undefined
component occurs in the imputed DTC value, the imputed DTC value is set to
NA_character_ in the imputation functions.
A list of character vectors. The elements of the list are named "year", "month", "day".
impute_dtc_dtm(), impute_dtc_dt()
Utilities used for date imputation:
dt_level(),
dtm_level(),
get_imputation_target_time(),
get_partialdatetime(),
restrict_imputed_dtc_dt(),
restrict_imputed_dtc_dtm()
# Get imputation target for "first"
target_first <- admiral:::get_imputation_target_date("first", month = NA)
print(target_first)
# Get imputation target for "mid" with specified month
target_mid <- admiral:::get_imputation_target_date("mid", month = "03")
print(target_mid)
# Get imputation target for "mid" with NA month
target_mid_na <- admiral:::get_imputation_target_date("mid", month = NA)
print(target_mid_na)
# Get imputation target for "last"
target_last <- admiral:::get_imputation_target_date("last", month = NA)
print(target_last)
# Get imputation target for custom date imputation "06-15"
target_custom <- admiral:::get_imputation_target_date("06-15", month = NA)
print(target_custom)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.