I have blank/empty values in my dataset after loading it from csv.
I found out that I can do this:
data$col[data$col==""] <- "NA"
data$col <- as.factor(data$col)
to change them to NA but I have nearly 200 columns so it's not the best method. I tried a for loop with all types of indexation but it didn't really work. What am I missing? Except overwriting my data multiple times with NA's
for (i in 1:189) {
if (class(data[[i]]) == "character") {
data[data[[i]] == "", ] <- "NA"
}