Hello,

When using hist() with a POSIXt date that has 00 seconds an error is
produced. For example

> hist(as.POSIXlt("2010-07-01 00:00:00"), breaks="mins")
Error in seq_len(1L + max(which(breaks < maxx))) :
  argument must be coercible to non-negative integer
In addition: Warning message:
In max(which(breaks < maxx)) :
  no non-missing arguments to max; returning -Inf

> hist(as.POSIXlt("2010-07-01 10:10:00"), breaks="mins")
Error in seq_len(1L + max(which(breaks < maxx))) :
  argument must be coercible to non-negative integer
In addition: Warning message:
In max(which(breaks < maxx)) :
  no non-missing arguments to max; returning -Inf

When adding one second, it completes successfully.

> hist(as.POSIXlt("2010-07-01 00:00:01"), breaks="mins")

> hist(as.POSIXlt("2010-07-01 10:10:01"), breaks="mins")

The error is produced when breaks is either secs, mins, hours, or day, but
does not occur with year, month or week.

I realise a histogram of one element is not useful, however, the errors
produced seem inconsistent. Is this expected behaviour?

This maybe useful:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United
Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C

[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.0.1

Best wishes
Steve

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to