I have a dataframe combi including two variables DT and OD.
I have a few missing values NA in both DT and OD but not necessary the same record.
I then try to rep
The warning is produced because you are trying to assign all combi$OD
to the places where combi$DT
is NA. For example if you have 100 rows of 2 variables with 5 NAs, then you are telling it to replace those 5 NAs of variable1 with the 100 values of variable2. Hence the warning. Try this instead,
combi$DT[is.na(combi$DT) & !is.na(combi$OD)] <- combi$OD[is.na(combi$DT) & !is.na(combi$OD)]