| Line 68... |
Line 68... |
| 68 |
\seealso{
|
68 |
\seealso{
|
| 69 |
\code{\link{seq.POSIXt}}, \code{\link{axis.POSIXct}}, \code{\link{hist}}
|
69 |
\code{\link{seq.POSIXt}}, \code{\link{axis.POSIXct}}, \code{\link{hist}}
|
| 70 |
}
|
70 |
}
|
| 71 |
\examples{
|
71 |
\examples{
|
| 72 |
hist(.leap.seconds, "years", freq = TRUE)
|
72 |
hist(.leap.seconds, "years", freq = TRUE)
|
| 73 |
hist(.leap.seconds,
|
- |
|
| 74 |
seq(ISOdate(1970, 1, 1), ISOdate(2020, 1, 1), "5 years"))
|
73 |
brks <- seq(ISOdate(1970, 1, 1), ISOdate(2030, 1, 1), "5 years")
|
| - |
|
74 |
hist(.leap.seconds, brks)
|
| 75 |
rug(.leap.seconds, lwd=2)
|
75 |
rug(.leap.seconds, lwd=2)
|
| - |
|
76 |
## show that 'include.lowest' "works"
|
| - |
|
77 |
stopifnot(identical(c(2L, rep(1L,11)),
|
| - |
|
78 |
hist(brks, brks, plot=FALSE, include.lowest=TRUE )$counts))
|
| - |
|
79 |
tools::assertError(verbose=TRUE, ##--> 'breaks' do not span range of 'x'
|
| - |
|
80 |
hist(brks, brks, plot=FALSE, include.lowest=FALSE))
|
| - |
|
81 |
## The default fuzz in hist.default() "kills" this, with a "wrong" message:
|
| - |
|
82 |
try ( hist(brks[-13] + 1, brks, include.lowest = FALSE) )
|
| - |
|
83 |
## and decreasing 'fuzz' solves the issue:
|
| - |
|
84 |
hb <- hist(brks[-13] + 1, brks, include.lowest = FALSE, fuzz = 1e-10)
|
| - |
|
85 |
stopifnot(hb$counts == 1)
|
| 76 |
|
86 |
|
| 77 |
## 100 random dates in a 10-week period
|
87 |
## 100 random dates in a 10-week period
|
| 78 |
random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
|
88 |
random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
|
| 79 |
hist(random.dates, "weeks", format = "\%d \%b")
|
89 |
hist(random.dates, "weeks", format = "\%d \%b")
|
| 80 |
}
|
90 |
}
|