in Technology by (1.9m points)

You are solving a data science problem that is ridden with many missing values. You want to clean the data before fitting your model. What would you do to replace these missing values? Develop your own function.

1 Answer

0 votes
by (1.9m points)
Let’s take this vector:

Now, let’s write the function to impute the values:
missing_mean <- function(arr){
ifelse(,mean(arr,na.rm = T),arr)