Converting dates before January 1, 1970 in R

前端 未结 3 1602
予麋鹿
予麋鹿 2021-01-27 06:05

I am trying to convert a column of dates into Date objects in R, but I can\'t seem to get the desired results. These individuals have birth dates before January 1, 1970, so when

3条回答
  •  不知归路
    2021-01-27 06:30

    I would do:

    library(lubridate)
    
    x <- as.Date("1/12/54", format = "%m/%d/%y")
    year(x) <- 1900 + year(x) %% 100
    
    > x
    [1] "1954-01-12"
    

提交回复
热议问题