Write a custom function which will replace all the missing values in a vector with the mean of values.



Write a custom function which will replace all the missing values in a vector with the mean of value..

Answer / Saurabh Vishnoi

```Rnncreate_mean_imputation_function <- function(x) {n mean_value <- mean(x, na.rm = TRUE)n x[is.na(x)] <- mean_valuen return(x)n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More R Programming Interview Questions

What do you understand by data visualization in R using ggplot2?

1 Answers  


What is white noise model in r?

1 Answers  


Explain how R commands are written?

1 Answers  


What is the use of “next” statement in R?

1 Answers  


How would you facet the data using ggplot2 package?

1 Answers  


What is data structure in r?

1 Answers  


What is recursive function in r?

1 Answers  


Which data object in r is used to store and process categorical data?

1 Answers  


How many data structures does r language have?

1 Answers  


What do you understand by a workspace in r programming language?

1 Answers  


How would you find the number of missing values in a dataset and remove all of them?

1 Answers  


What is transpose?

1 Answers  


Categories