The R Project SVN R

Rev

Rev 80917 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80917 Rev 80951
Line 1... Line 1...
1
 
1
 
2
R Under development (unstable) (2021-09-14 r80893) -- "Unsuffered Consequences"
2
R Under development (unstable) (2021-09-17 r80929) -- "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 1036... Line 1036...
1036
Asserted error: some 'x' not counted; maybe 'breaks' do not span range of 'x'
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:
1037
> ## The default fuzz in hist.default()  "kills" this, with a "wrong" message:
1038
> try ( hist(brks[-13] + 1, brks, include.lowest = FALSE) )
1038
> try ( hist(brks[-13] + 1, brks, include.lowest = FALSE) )
1039
Error in hist.default(unclass(x), unclass(breaks), plot = FALSE, warn.unused = 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'
1040
  some 'x' not counted; maybe 'breaks' do not span range of 'x'
1041
> ##  decreasing 'fuzz' solves the issue:
1041
> ## and decreasing 'fuzz' solves the issue:
1042
> hb <- hist(brks[-13] + 1, brks, include.lowest = FALSE, fuzz = 1e-10)
1042
> hb <- hist(brks[-13] + 1, brks, include.lowest = FALSE, fuzz = 1e-10)
1043
> stopifnot(hb$counts == 1)
1043
> stopifnot(hb$counts == 1)
1044
> 
1044
> 
1045
> ## 100 random dates in a 10-week period
1045
> ## 100 random dates in a 10-week period
1046
> random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
1046
> random.dates <- as.Date("2001/1/1") + 70*stats::runif(100)
Line 1114... Line 1114...
1114
> hist(c(2,3,3,5,5,6,6,6,7))
1114
> hist(c(2,3,3,5,5,6,6,6,7))
1115
> 
1115
> 
1116
> require(stats)
1116
> require(stats)
1117
> set.seed(14)
1117
> set.seed(14)
1118
> x <- rchisq(100, df = 4)
1118
> x <- rchisq(100, df = 4)
-
 
1119
> 
-
 
1120
> ## Histogram with custom x-axis:
-
 
1121
> hist(x, xaxt = "n")
-
 
1122
> axis(1, at = 0:17)
-
 
1123
> 
1119
> ## Don't show: 
1124
> ## Don't show: 
1120
> op <- par(mfrow = 2:1, mgp = c(1.5, 0.6, 0), mar = .1 + c(3,3:1))
1125
> op <- par(mfrow = 2:1, mgp = c(1.5, 0.6, 0), mar = .1 + c(3,3:1))
1121
> ## End(Don't show)
1126
> ## End(Don't show)
1122
> ## Comparing data with a model distribution should be done with qqplot()!
1127
> ## Comparing data with a model distribution should be done with qqplot()!
1123
> qqplot(x, qchisq(ppoints(x), df = 4)); abline(0, 1, col = 2, lty = 2)
1128
> qqplot(x, qchisq(ppoints(x), df = 4)); abline(0, 1, col = 2, lty = 2)