###### Generic ###########
my_df %>%
mutate(x1 = replace_na(x1,mean(x1, na.rm = TRUE)))
####### Simba specific ############
data %>%
group_by( # Replace missing values with group mean
Variables) %>%
mutate(
Values = replace_na(Values, mean(Values, na.rm = TRUE))
)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter