View source: R/derive_vars_dt_dtm_utils.R
get_imputation_targets | R Documentation |
Determines the imputation targets for date (see get_imputation_target_date()
and time
(see get_imputation_target_time()
) components.
get_imputation_targets(partial, date_imputation = NULL, time_imputation = NULL)
partial |
A list of partial date/time components.
|
date_imputation |
The value to impute the day/month when a datepart is missing. A character value is expected, either as a
|
time_imputation |
The value to impute the time when a timepart is missing. A character value is expected, either as a
|
A list of imputation targets for date and (if applicable) time components.
# Get imputation targets for a date with 'first' date imputation
partial_date <- list(year = "2020", month = "03", day = NA_character_)
target_first_date <- admiral:::get_imputation_targets(partial_date,
date_imputation = "first",
time_imputation = NULL
)
print(target_first_date)
# Get imputation targets for a datetime with 'first' date and time imputation
partial_datetime <- list(
year = "2020",
month = "03",
day = NA_character_,
hour = "12",
minute = NA_character_,
second = NA_character_
)
target_first_datetime <- admiral:::get_imputation_targets(partial_datetime,
date_imputation = "first",
time_imputation = "first"
)
print(target_first_datetime)
# Get imputation targets for a datetime with 'last' date and time imputation
target_last_datetime <- admiral:::get_imputation_targets(partial_datetime,
date_imputation = "last",
time_imputation = "last"
)
print(target_last_datetime)
# Get imputation targets for a date with custom date imputation '06-15'
target_custom_date <- admiral:::get_imputation_targets(partial_date,
date_imputation = "06-15",
time_imputation = NULL
)
print(target_custom_date)
# Get imputation targets for a datetime with custom time imputation '12:34:56'
target_custom_time <- admiral:::get_imputation_targets(partial_datetime,
date_imputation = "first",
time_imputation = "12:34:56"
)
print(target_custom_time)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.