Allows user to do left_join and fill missing NA values with 0 or other optional value depending on the type of variable.
left_join_replace_na(x, y, na_replace_list, ...)
x | tibble data to used as left in a join |
---|---|
y | tibble data to used as right in a join |
na_replace_list | a list definitions of na replacement values for each type of variable (based on 'class' or 'get_var_types' functions) |
Other help functions:
get_classification_name()
,
get_na_vars()
,
get_var_types()
,
make_regex()
,
replace_na_by_type()
if (FALSE) { ## Give list of NA values replace_list <- list( "logical"=FALSE, "character"="", "integer"=0L, "double"=0.0, "numeric"=0, "Date"=lubridate::dmy("01-01-1900") ) d_na <- left_join_replace_na(sample_cohort,sample_regdata) d_filled <- left_join_replace_na(sample_cohort,sample_regdata,replace_list) c("d_na"=sum(is.na(d_na)),"d_filled"=sum(is.na(d_filled))) }