with Andreas suggestion and further reading, i came up with the following which worked a treat. thanks
agg_cats_thresholds <- c(0.01, 0.05, 0.005, 0.001)
agg_cats_thresholds <- as.data.frame(agg_cats_thresholds)
#create the lists of variables
factor_columns1 <- c("a", "b","c", "d", "e")
factor_columns2 <- c("f")
factor_columns3 <- c("g")
factor_columns4 <- c("h", "i", "j", "k")
# Use fct_lump_prop to reduce the levels of the various factor variables
churn.ml[factor_columns1] <- lapply(churn.ml[factor_columns1],
fct_lump_prop, prop = agg_cats_thresholds[1,]
,other_level = 'other')
churn.ml[factor_columns2] <- lapply(churn.ml[factor_columns2],
fct_lump_prop, prop =
agg_cats_thresholds[2,] ,other_level = 'other')
churn.ml[factor_columns3] <- lapply(churn.ml[factor_columns3],
fct_lump_prop, prop =
agg_cats_thresholds[3,] ,other_level = 'other')