mydat <- data.frame(id = c(1, 1, 2), date_of_entry = c(NA, NA, NA))
mydate <- structure(17189, class = "Date")
> mydate
[1] "2017-01-23"
mydate is a date, and I want to populate the date_of_entry column with that mydate for id == 1. If I tried:
mydat$date_of_entry[mydat$id == 1] <- mydate
> mydat
id date_of_entry
1 1 17189
2 1 17189
3 2 NA
However, I want the date_of_entry column to contain the actual date, not a numerical representation of the date in R. How can I go about this?