Replace NA in column with value in adjacent column
It didn’t work because status was a factor. When you mix factor with numeric then numeric is the least restrictive. By forcing status to be character you get the results you’re after and the column is now a character vector: TEST$UNIT[is.na(TEST$UNIT)] <- as.character(TEST$STATUS[is.na(TEST$UNIT)]) ## UNIT STATUS TERMINATED START STOP ## 1 ACTIVE ACTIVE 1999-07-06 2007-04-23 … Read more