I have a very simple question
I have this value:
x <- 19630730
with class numeric. The as.Date() does not give me the expected result: 1963-07-30
what is the potential remedy to convert x to a date?
Thanks
Convert to character first
x <- 19630730
as.Date(as.character(x), "%Y%m%d")
#[1] "1963-07-30"
If you use lubridate::ymd you don't need to convert to character.
lubridate::ymd(x)