Skip to contents

Imputation function for a categorical column using the most frequent value

Usage

cat_imputer(x, col)

Arguments

x

input data tibble

col

name of the column to modify

Value

output data tibble after imputation

Examples

input_df <- data.frame(a = c('BC', 'BC', 'ON', 'AB', NA))
cat_imputer(input_df, "a")
#>    a
#> 1 BC
#> 2 BC
#> 3 ON
#> 4 AB
#> 5 BC