From ripley at stats.ox.ac.uk  Fri Apr 23 23:38:36 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri Apr 23 23:45:32 2004
Subject: [Rd] is.na(valid_date) too often true on SGI MIPS (PR#6814)
In-Reply-To: <Pine.SGI.4.58.0404231527420.165455@montigo.bio.dfo.ca>
Message-ID: <Pine.LNX.4.44.0404232235430.13187-100000@gannet.stats>

On Fri, 23 Apr 2004, George N. White III wrote:

> On Fri, 23 Apr 2004, Prof Brian Ripley wrote:
> 
> > I'm sorry, but this is completely unreproducible, and the second you say
> > is true you quote as false.
> 
> Not sure what you mean -- are you saying "make check" passes on
> other Irix systems?

We don't have an Irix system on which they fail _AND_ your examples 
are not in the R sources. N.B. as.Date and is.na(strptime()) are not the 
same code, and your second example is still not explained.

However, you reported to R bugs, not to Irix bugs, and no other R system 
has shown this behaviour.  So the finger is pointing elsewhere.

> > d is a list, so can you tell us unclass(d) in both cases?
> 
> Sure -- they look OK to me:
> > d<-strptime("1910/1/1", "%Y/%m/%d")
> > unclass(d)
> $sec
> [1] 0
> $min
> [1] 0
> $hour
> [1] 0
> $mday
> [1] 1
> $mon
> [1] 0
> $year
> [1] 10
> $wday
> [1] 6
> $yday
> [1] 0
> $isdst
> [1] -1
> > d<-strptime("1970/1/1", "%Y/%m/%d")
> > unclass(d)
> $sec
> [1] 0
> $min
> [1] 0
> $hour
> [1] 0
> $mday
> [1] 1
> $mon
> [1] 0
> $year
> [1] 70
> $wday
> [1] 4
> $yday
> [1] 0
> $isdst
> [1] 0
> 
> > Also, I cannot see those examples anywhere in the R sources so can you
> > please show the actual output you got.
> 
> My examples are based on as.POSIXlt from datetime.R.
> 
> Here are the relevant sections of the output from the tests (if I
> comment out these sections in reg-tests-1.R and base-Ex.R then
> "make check" runs fine):
> 
> $ cd ~/install/R/R-1.9.0/tests
> gwhite@montigo:/user/gwhite/install/R/R-1.9.0/tests
> $ gmake reg-tests-1.Rout
> running code in 'reg-tests-1.R' ...gmake: *** [reg-tests-1.Rout] Error 1
> $ tail -20 reg-tests-1.Rout.fail
> > (t1 <- strptime(c("6. Aug. 1930", "3. Nov. 1925", "28. Mar. 1959",
> +                  NA, paste(1:29," Feb. 1960", sep=".")),
> +                format = "%d. %b. %Y"))
>  [1] "1930-08-06" "1925-11-03" "1959-03-28" NA           "1960-02-01"
>  [6] "1960-02-02" "1960-02-03" "1960-02-04" "1960-02-05" "1960-02-06"
> [11] "1960-02-07" "1960-02-08" "1960-02-09" "1960-02-10" "1960-02-11"
> [16] "1960-02-12" "1960-02-13" "1960-02-14" "1960-02-15" "1960-02-16"
> [21] "1960-02-17" "1960-02-18" "1960-02-19" "1960-02-20" "1960-02-21"
> [26] "1960-02-22" "1960-02-23" "1960-02-24" "1960-02-25" "1960-02-26"
> [31] "1960-02-27" "1960-02-28" "1960-02-29"
> > stopifnot(6 == length(print(s1 <- summary(t1))),
> +           s1== summary(as.POSIXct(t1)),
> +           6 == length(print(format(as.Date(s1)))) )
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>      NA      NA      NA      NA      NA      NA
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>      NA      NA      NA      NA      NA      NA
> Error in if (!(is.logical(r <- eval(ll[[i]])) && all(r))) stop(paste(deparse(mc[[i +  :
>         missing value where TRUE/FALSE needed
> Execution halted
> $ cd Examples
> $ gmake base-Ex.Rout
> running code in 'base-Ex.R' ...
> Execution halted
> $ tail -4 base-Ex.Rout.fail
> > ## first days of years
> > seq(as.Date("1910/1/1"), as.Date("1999/1/1"), "years")
> Error in fromchar(x) : character string is not in a standard unambiguous format
> Execution halted
> 
> > On Fri, 23 Apr 2004 aa056@chebucto.ns.ca wrote:
> >
> > > Full_Name: George N. White III
> > > Version: 1.9.0
> > > OS: Irix 6.5.21m
> > > Submission from: (NULL) (142.176.61.212)
> > >
> > >
> > > R-1.9.0 built using the SGI MIPSPro compilers
> > >
> > >   Installation directory:    /usr/local
> > >
> > >   C compiler:                c99 -OPT:IEEE_NaN_inf=ON -mips4 -n32 -O3
> > > -OPT:Olimit_opt=on
> > >   C++ compiler:              CC -OPT:IEEE_NaN_inf=ON -mips4 -n32 -O3
> > > -OPT:Olimit_opt=on -LANG:std
> > >   Fortran compiler:          f90 -OPT:IEEE_NaN_inf=ON -mips4 -n32 -O3
> > > -OPT:Olimit_opt=on
> > >
> > >   Interfaces supported:      X11, gnome, tcltk
> > >   External libraries:        readline, BLAS(generic), LAPACK(generic)
> > >   Additional capabilities:   PNG, JPEG
> > >   Options enabled:           shared library, R profiling
> > >
> > >   Recommended packages:      yes
> > >
> > > "make check" fails in 2 places due to is.na(..) returning TRUE for valid dates:
> > >
> > > > d<-strptime("1910/1/1", "%Y/%m/%d")
> > > > is.na(d)
> > > [1] TRUE
> > > > d
> > > [1] "1910-01-01"
> > >
> > > > d<-strptime("1970/1/1", "%Y/%m/%d")
> > > > is.na(d)
> > > [1] FALSE
> > > > d
> > > [1] "1970-01-01"
> > >
> > > Incidentally:
> > > > NA+NaN;NaN+NA
> > > [1] NA
> > > [1] NaN
> > >
> > > ______________________________________________
> > > R-devel@stat.math.ethz.ch mailing list
> > > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> > >
> > >
> >
> >
> 
> --
> George N. White III  <aa056@chebucto.ns.ca>
>   Head of St. Margarets Bay, Nova Scotia, Canada
> 
> 

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] is.na(valid_date) too often true on SGI MIPS (PR#6814)
Prof Brian Ripley