问题
I'm facing a ridiculous situation. To tackle missing data issue, I used this code:
fixed_data <- fetch_data[-which(! complete.cases(train_sample)),]
train_index <- sample(1:nrow(fixed_data), size = .7*nrow(fixed_data))
train_sample <- fixed_data[train_index, ]
test_sample <- fixed_data[-train_index,]
Then I check the rows of portioned data to make sure there's no missing value, but there's still missing value!
length(which(! complete.cases(fixed_data)))
回答1:
I changed the code to
fixed_data <- fetch_data[which(complete.cases(fetch_data)),]
And it's working now. What a silly mistake!
来源:https://stackoverflow.com/questions/36628341/handling-missing-data-in-r