r summarize_if with multiple conditions
One possibility could be:
df_finale %>%
summarise_all(~ if(is.numeric(.)) mean(., na.rm = TRUE) else Mode(.))
num str
1 4 toy
Or an option since dplyr 1.0.0
:
df_finale %>%
summarise(across(everything(), ~ if(is.numeric(.)) mean(., na.rm = TRUE) else Mode(.)))