Impute missing location data
Arguments
- .data
A data frame or data frame extension (e.g. a tibble).
- tus_dat
A data frame of the time use survey data. This is expected to be in the format saved by
run_data_prep_tus()
.- col_nm
A character string: name of new column to create which will hold the most popular location for each activity (possibly by strata).
- missing_ids
An integer vector of the numeric id's which indicate missing locations.
- strata
An optional character vector containing names of stratification variables. If supplied, these are added to the activity and location variables to be used for grouping. Default: none.
Value
The supplied tus_dat
data frame with imputed data for missing
locations. Imputed values are computed as the most popular location for
activity by (optional) strata.
Examples
if (FALSE) { # \dontrun{
tus_dat <- get_tus_dat()
strata <- c("sex", "agegr4", "nssec5", "daytype")
impute_missing(tus_dat, tus_dat, "most_popular_locn", missing_ids, strata)
} # }