in Technology by (1.8m 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.8m points)
Let’s take this vector:

arr<-c(1,2,4,NA,NA,11,NA,10)
Now, let’s write the function to impute the values:
missing_mean <- function(arr){
ifelse(is.na(arr),mean(arr,na.rm = T),arr)
}

Related questions

0 votes
asked Nov 27, 2021 in Education by JackTerrance (1.8m points)
...