Hi R Studio Community,
Below in dataset, I have date 1 with missing and I would like to replace the missing date by date2 column, if somebody can help me. It is highly appreciate it. Thanks
# replace missing date by another date
data2 <- data.frame(x1 = 1:10,
date1 = c("2020-01-25", NA,"2021-03-15",NA,"2021-05-11","2020-06-07","2021-08-08", NA,"2020-10-18", "2021-11-11"),
x3 = c(" ", "B", "A", "F","F", " "," ", " "," "," "),
date2 = c("2021-01-25", "2022-02-10","2020-03-15","2021-04-09","2020-05-11",NA,"2020-09-08", NA,"2021-05-18", "2020-10-11"),
x4 = factor(c("B", "B", "A", "F", "A", "B", "A", "B","A", "B")),
stringsAsFactors = FALSE)