8658/custom-function-which-replace-missing-values-vector-values
Consider this vector:
a<-c(1,2,3,NA,4,5,NA,NA)
Write the function to impute the values:
mean_impute<-function(x){ ifelse(is.na(x),mean(x,na.rm = T),x) }
The result would be as follows:
mean_impute(a)
1 2 3 3 4 5 3 3
Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE
Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE
If you used sub() to replace the ...READ MORE
If you have a condition using which ...READ MORE
It's easier to convert alpha to characters ...READ MORE
You can use something like this: df$grp.mean.values <- ...READ MORE
Consider the inbuilt iris dataset in R. Use ...READ MORE
Dear Koushik, Hope you are doing great. You can ...READ MORE
It is simple and easy: df1<-as.data.frame(matrix(sample(c(NA, 1:10), 100, ...READ MORE
You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.