I need to cleansing the data that contain the value of '' (a null value of string). There are two things I will do next: 1. Counting the number of null string value. 2. Replacing them with NA value
However, there are some problem to accomplish the work. I tried using the sapply function with the function of isBlank (identifying the null srting value). It doesn't return the value of TRUE/FALSE for each element but for each column. Thus I can't use the colSums function to do the job.
I'm not sure if it could be the string manipulation function as a parameter to sapply, could anyone help me with it?
isBlank=function(x){
if(!is.na(x) && x==''){
return(TRUE)
}else{
return(FALSE)
}
}
sapply(train,isBlank)