I'm installing R on an Irix 6.5 machine and R fails to understand dates prior to 1 Jan 1970. This first cropped up early in the test scripts (Examples/base-Ex.R):

> 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

The root there is the as.Date("1910/1/1"), which returns that same error when entered alone. Any date on or after 1 Jan 1970 works fine; any before fails with the same error. Obviously, I've not tried every date, but that seems to be the case.


I got by that test by changing "1910" to "1970", but it crops up later, too (reg-tests-1.R):

> ## Date objects with NA's
> (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

Interestingly, strptime() seems to return the correct results, as can be seen in the output above, but the problem occurs in summary() and in as.POSIXct():


> summary(t1)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA NA NA NA NA NA > as.POSIXct(t1)
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[26] NA NA NA NA NA NA NA NA

This check, too, can be avoided if I change the dates created:

> (t1 <- strptime(c("6. Aug. 1970", "3. Nov. 19725", "28. Mar. 1979",
+ NA, paste(1:29," Feb. 1980", sep=".")),
+ format = "%d. %b. %Y"))
[1] "1970-08-06" "1972-11-03" "1979-03-28" NA "1980-02-01"
[6] "1980-02-02" "1980-02-03" "1980-02-04" "1980-02-05" "1980-02-06"
[11] "1980-02-07" "1980-02-08" "1980-02-09" "1980-02-10" "1980-02-11"
[16] "1980-02-12" "1980-02-13" "1980-02-14" "1980-02-15" "1980-02-16"
[21] "1980-02-17" "1980-02-18" "1980-02-19" "1980-02-20" "1980-02-21"
[26] "1980-02-22" "1980-02-23" "1980-02-24" "1980-02-25" "1980-02-26"
[31] "1980-02-27" "1980-02-28" "1980-02-29"
> summary(t1)
Min. 1st Qu. Median "1970-08-06 00:00:00 EDT" "1980-02-05 18:00:00 EST" "1980-02-13 12:00:00 EST" Mean 3rd Qu. Max. "1979-07-28 00:58:07 EDT" "1980-02-21 06:00:00 EST" "1980-02-29 00:00:00 EST" > as.POSIXct(t1)
[1] "1970-08-06 EDT" "1972-11-03 EST" "1979-03-28 EST" NA [5] "1980-02-01 EST" "1980-02-02 EST" "1980-02-03 EST" "1980-02-04 EST"
[9] "1980-02-05 EST" "1980-02-06 EST" "1980-02-07 EST" "1980-02-08 EST"
[13] "1980-02-09 EST" "1980-02-10 EST" "1980-02-11 EST" "1980-02-12 EST"
[17] "1980-02-13 EST" "1980-02-14 EST" "1980-02-15 EST" "1980-02-16 EST"
[21] "1980-02-17 EST" "1980-02-18 EST" "1980-02-19 EST" "1980-02-20 EST"
[25] "1980-02-21 EST" "1980-02-22 EST" "1980-02-23 EST" "1980-02-24 EST"
[29] "1980-02-25 EST" "1980-02-26 EST" "1980-02-27 EST" "1980-02-28 EST"
[33] "1980-02-29 EST"

Anyone have any ideas?

-Bitt

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to