[R] Help with dates

peter dalgaard pdalgd at gmail.com
Fri Dec 29 09:13:22 CET 2017


Mostly agree, except that I would suggest hardcoding the notion of "in the future", so that you don't get surprises when someone reruns your code 20 years from now.

-pd

> On 28 Dec 2017, at 21:54 , Simmering, Jacob E <jacob-simmering at uiowa.edu> wrote:
> 
> Your dates have an incomplete year information with 34. R assumes that 00-68 are 2000 to 2068 and 69 to 99 are 1969 to 1999. See ?strptime and the details for %y. 
> 
> You can either append “19” to the start of your year variable to make it completely express the year or check if the date is in the future (assuming all dates should be in the past) and subtract 100 years from the date. 
> 
> 
>> On Dec 28, 2017, at 11:13 AM, Ramesh YAPALPARVI <ramesh.yapalparvi at icloud.com> wrote:
>> 
>> Hi all,
>> 
>> I’m struggling to get the dates in proper format.
>> I have dates as factors and is in the form 02/27/34( 34 means 1934). If I use
>> 
>> as.Date with format %d%m%y it gets converted to 2034-02-27. I tried changing the origin in the as.Date command but nothing worked. Any help is appreciated.
>> 
>> Thanks,
>> Ramesh
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list