[Rd] strptime bug (PR#1155)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Thu, 1 Nov 2001 09:15:38 +0100 (MET)
On Wed, 31 Oct 2001, Rich Heiberger wrote:
> Where is the strptime bug happening? I am seeing it on W95 W98 W2000
> running Rterm under ntemacs 21.1 with ESS 5.1.19 and using cygwin
> 2001/08/31 15:52:16 Starting cygwin install, version 2.78.2.3
It is happening on all glibc-based systems. R on Windows uses glibc to
replace the missing functionality here.
> Is strptime using the bash from my system? or is it using functions
> that are included with R?
The second.
> R defaulted to 1900 when I didn't specify a year. The 1990 came from
> the help(beav1).
>
> When I explicitly place a year in the file, either the 1990 inidcated
> in the help(beav1) file or the 1900 chosen to match the default, then
> R gives me times consistent with the input.
Yes, that's the bug. According to the docs it should fail in all the
cases (which would be silly), but the code has at least two internal
logical mistakes.
It will be fixed in the next release.
> > tmp <- beav1[90:93,]
> > tmp
> day time temp activ
> 90 346 2340 36.93 0
> 91 346 2350 36.83 0
> 92 347 0 36.93 0
> 93 347 10 36.83 0
> > attach(tmp)
> > strptime(paste(day, time %/% 100, time %% 100), "%j %H %M")
> [1] "1900-01-01 23:40:00" "1900-01-01 23:50:00" "1900-01-01 00:00:00"
> [4] "1900-01-01 00:10:00"
> > strptime(paste(1900, day, time %/% 100, time %% 100), "%Y %j %H %M")
> [1] "1900-12-12 23:40:00" "1900-12-12 23:50:00" "1900-12-13 00:00:00"
> [4] "1900-12-13 00:10:00"
> > strptime(paste(1990, day, time %/% 100, time %% 100), "%Y %j %H %M")
> [1] "1990-12-12 23:40:00" "1990-12-12 23:50:00" "1990-12-13 00:00:00"
> [4] "1990-12-13 00:10:00"
> >
>
>
> Rich
>
--
Brian D. Ripley, ripley@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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._