Posted on 28th April 2025|403 views
Why am I getting an error number of items to replace is not a multiple of replacement length?
this is the code I am using
combi$DT[is.na(combi$DT) & ! is.na(combi$OD) ] <- combi$OD
Posted on 28th April 2025| views
The warning is displayed because you are attempting to assign total combi$OD to the areas wherever combi$DT is NA. For instance, if you hold 100 rows of 2 variables among 5 NAs, then you are saying it to substitute those 5 NAs of variable1 by the 100 values regarding variable2. So the warning. Work with this instead,
combi$DT[is.na(combi$DT) & !is.na(combi$OD)] <- combi$OD[is.na(combi$DT) & !is.na(combi$OD)]