How to deal with dates which are less than 1970 in R



When R looks at dates , its origin is January 1, 1970. Now in my one variable date of birth is 3rd Jan 1970 but R can’t handle this as it is less then 1970… Is there any way to deal with this in R?


@deepak9oct- I think you want to ask how to handle date variable.

 x <- as.Date("1970-01-02")
[1] 1

The output is 1 because the default date in R is 1970-01-01 and R always calculate the other date’s as keeping this date as a base.

Hope this helps!



Thanks hinduja, I know this but my question is if date is less then 1970…lets say that my date is “1959-Jan-31”…Now R can’t handle this date since by default R takes date value starting from 1970…
Is there any way to handle year less then 1970 in R?


Can you please tell me how to convert January 1, 2015 in Date using R? And I want to be create group year wise and month wise for particular year?

How can I do in R?
I tried to do using group_by function but I guess my Date format is not properly so can anyone please help me in it