| Line 1... |
Line 1... |
| 1 |
|
1 |
|
| 2 |
R Under development (unstable) (2021-07-20 r80647) -- "Unsuffered Consequences"
|
2 |
R Under development (unstable) (2021-09-14 r80893) -- "Unsuffered Consequences"
|
| 3 |
Copyright (C) 2021 The R Foundation for Statistical Computing
|
3 |
Copyright (C) 2021 The R Foundation for Statistical Computing
|
| 4 |
Platform: x86_64-pc-linux-gnu (64-bit)
|
4 |
Platform: x86_64-pc-linux-gnu (64-bit)
|
| 5 |
|
5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
| 7 |
You are welcome to redistribute it under certain conditions.
|
7 |
You are welcome to redistribute it under certain conditions.
|
| Line 1023... |
Line 1023... |
| 1023 |
> ### Keywords: chron dplot hplot
|
1023 |
> ### Keywords: chron dplot hplot
|
| 1024 |
>
|
1024 |
>
|
| 1025 |
> ### ** Examples
|
1025 |
> ### ** Examples
|
| 1026 |
>
|
1026 |
>
|
| 1027 |
> hist(.leap.seconds, "years", freq = TRUE)
|
1027 |
> hist(.leap.seconds, "years", freq = TRUE)
|
| 1028 |
> hist(.leap.seconds,
|
- |
|
| 1029 |
+ seq(ISOdate(1970, 1, 1), ISOdate(2020, 1, 1), "5 years"))
|
1028 |
> brks <- seq(ISOdate(1970, 1, 1), ISOdate(2030, 1, 1), "5 years")
|
| - |
|
1029 |
> hist(.leap.seconds, brks)
|
| 1030 |
> rug(.leap.seconds, lwd=2)
|
1030 |
> rug(.leap.seconds, lwd=2)
|
| - |
|
1031 |
> ## show that 'include.lowest' "works"
|
| - |
|
1032 |
> stopifnot(identical(c(2L, rep(1L,11)),
|
| - |
|
1033 |
+ hist(brks, brks, plot=FALSE, include.lowest=TRUE )$counts))
|
| - |
|
1034 |
> tools::assertError(verbose=TRUE, ##--> 'breaks' do not span range of 'x'
|
| - |
|
1035 |
+ hist(brks, brks, plot=FALSE, include.lowest=FALSE))
|
| - |
|
1036 |
Asserted error: some 'x' not counted; maybe 'breaks' do not span range of 'x'
|
| - |
|
1037 |
> ## The default fuzz in hist.default() "kills" this, with a "wrong" message:
|
| - |
|
1038 |
> try ( hist(brks[-13] + 1, brks, include.lowest = FALSE) )
|
| - |
|
1039 |
Error in hist.default(unclass(x), unclass(breaks), plot = FALSE, warn.unused = FALSE, :
|
| - |
|
1040 |
some 'x' not counted; maybe 'breaks' do not span range of 'x'
|
| - |
|
1041 |
> ## decreasing 'fuzz' solves the issue:
|
| - |
|
1042 |
> hb <- hist(brks[-13] + 1, brks, include.lowest = FALSE, fuzz = 1e-10)
|
| - |
|
1043 |
> stopifnot(hb$counts == 1)
|
| 1031 |
>
|
1044 |
>
|
| 1032 |
> ## 100 random dates in a 10-week period
|
1045 |
> ## 100 random dates in a 10-week period
|
| 1033 |
> random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
|
1046 |
> random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
|
| 1034 |
> hist(random.dates, "weeks", format = "%d %b")
|
1047 |
> hist(random.dates, "weeks", format = "%d %b")
|
| 1035 |
>
|
1048 |
>
|
| Line 1095... |
Line 1108... |
| 1095 |
>
|
1108 |
>
|
| 1096 |
> hist(islands, breaks = c(12,20,36,80,200,1000,17000), freq = TRUE,
|
1109 |
> hist(islands, breaks = c(12,20,36,80,200,1000,17000), freq = TRUE,
|
| 1097 |
+ main = "WRONG histogram") # and warning
|
1110 |
+ main = "WRONG histogram") # and warning
|
| 1098 |
Warning in plot.histogram(r, freq = freq1, col = col, border = border, angle = angle, :
|
1111 |
Warning in plot.histogram(r, freq = freq1, col = col, border = border, angle = angle, :
|
| 1099 |
the AREAS in the plot are wrong -- rather use 'freq = FALSE'
|
1112 |
the AREAS in the plot are wrong -- rather use 'freq = FALSE'
|
| - |
|
1113 |
> ## R >= 4.2.0: no "*.5" labels on y-axis:
|
| - |
|
1114 |
> hist(c(2,3,3,5,5,6,6,6,7))
|
| - |
|
1115 |
>
|
| 1100 |
> require(stats)
|
1116 |
> require(stats)
|
| 1101 |
> set.seed(14)
|
1117 |
> set.seed(14)
|
| 1102 |
> x <- rchisq(100, df = 4)
|
1118 |
> x <- rchisq(100, df = 4)
|
| 1103 |
> ## Don't show:
|
1119 |
> ## Don't show:
|
| 1104 |
> op <- par(mfrow = 2:1, mgp = c(1.5, 0.6, 0), mar = .1 + c(3,3:1))
|
1120 |
> op <- par(mfrow = 2:1, mgp = c(1.5, 0.6, 0), mar = .1 + c(3,3:1))
|
| Line 3099... |
Line 3115... |
| 3099 |
> ### * <FOOTER>
|
3115 |
> ### * <FOOTER>
|
| 3100 |
> ###
|
3116 |
> ###
|
| 3101 |
> cleanEx()
|
3117 |
> cleanEx()
|
| 3102 |
> options(digits = 7L)
|
3118 |
> options(digits = 7L)
|
| 3103 |
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
|
3119 |
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
|
| 3104 |
Time elapsed: 3.453 0.216 3.777 0 0
|
3120 |
Time elapsed: 2.623 0.089 2.767 0 0
|
| 3105 |
> grDevices::dev.off()
|
3121 |
> grDevices::dev.off()
|
| 3106 |
null device
|
3122 |
null device
|
| 3107 |
1
|
3123 |
1
|
| 3108 |
> ###
|
3124 |
> ###
|
| 3109 |
> ### Local variables: ***
|
3125 |
> ### Local variables: ***
|