vec <- rnorm(10)
vec[sample(1:10, 3)] <- NA
impute_mode(vec)
library(dplyr)
dat <- tibble(
num = rnorm(10),
int = rpois(10, 5),
fct = factor(LETTERS[1:10])
) %>%
mutate(
across(
everything(),
\(x) set_prop_miss(x, prop = 0.25)
)
)
dat
dat %>%
nabular() %>%
mutate(
num = impute_mode(num),
int = impute_mode(int),
fct = impute_mode(fct)
)
Run the code above in your browser using DataLab