This is my code:
data <- data.frame(x = c(1, 2, NA, 4, 5),
y = c(6, 7, NA, 9, 10))
# Calcular a média de todas as colunas, incluindo NA's
mean <- colMeans(dados, na.rm = TRUE)
# Exibir o resultado
mean
Now replacing the Na's by the mean calulated above using replace_na function:
data %>% replace_na(list(mean))
I need to use the replace_na()
function
Any help?