Home > Software engineering >  Handling empty cell values in R for logistic regression
Handling empty cell values in R for logistic regression

Time:11-21

I have a csv file with a bunch of "empty cells" and a few missing values. I was able to impute the mean of the variable value to fill in the missing values. However, I'm unable to replace the empty cells with a certain text that I want to. I have been trying the same impute function to replace the empty cells but the output does not change. Appreciate any help. Thank you

csv file variable output

CodePudding user response:

Here's one way to replace empty strings in a data frame column col:

df$col[df$col == ""] <- "whatever you want to put there"
  • Related