Re: [R] Strange julian and/or strptime

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri, 23 May 2008 10:41:03 +0100 (BST)

On my Linux box:

> strptime("010169", format = "%d%m%y")
[1] "1969-01-01"
> strptime("311268", format = "%d%m%y")
[1] "2068-12-31"

>From the help page:

      '%y' Year without century (00-99). If you use this on input, which
           century you get is system-specific.  So don't!  Often values
           up to 69 (or 68) are prefixed by 20 and 70 (or 69) to 99 by
           19.

If all else fails, read the documentation (but the posting guide asks you to do that before posting). Elsewhere on that help page it refers you to your OS documentation -- the posting guide asked for your OS 'at a minimum', but as you didn't follow it so we have no idea which you used.

On Fri, 23 May 2008, Kåre Edvardsen wrote:

> Hi r-helpers...
>
> Why do I get this strange huge jump of 36524 days when changing "origin"
> from 1969-01-01 to 1968-12-31. It should still be close to zero! This
> really messes up my calculations of follow-up times in my analyses.
>
>> julian(strptime("010169", format = "%d%m%y"),origin =
> as.Date("1969-01-01"))
>> Time difference of -0.04166667 days
>
>> julian(strptime("311268", format = "%d%m%y"),origin =
> as.Date("1968-12-31"))
>> Time difference of 36524.96 days
>
>
> Cheers,
> Kare
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


______________________________________________ R-help_at_r-project.org mailing list 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.

Received on Fri 23 May 2008 - 09:47:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 23 May 2008 - 12:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive