diff --git a/doc/manual/R-intro.R b/doc/manual/R-intro.R
index 6ccad072af1..280727d7491 100644
--- a/doc/manual/R-intro.R
+++ b/doc/manual/R-intro.R
@@ -40,7 +40,7 @@ seq(2,10)
all(seq(1,30) == seq(to=30, from=1))
seq(-5, 5, by=.2) -> s3
-s4 <- seq(length=51, from=-5, by=.2)
+s4 <- seq(length.out=51, from=-5, by=.2)
all.equal(s3,s4)
s5 <- rep(x, times=5)
@@ -145,7 +145,7 @@ x[i] <- 0 # Replace those elements by zeros.
x
n <- 60
-b <- 5 ; blocks <- rep(1:b, length= n)
+b <- 5 ; blocks <- rep(1:b, length.out= n)
v <- 6 ; varieties <- gl(v,10)
Xb <- matrix(0, n, b)
@@ -163,7 +163,7 @@ all(N == table(blocks,varieties))
h <- 1:17
Z <- array(h, dim=c(3,4,2))
## If the size of 'h' is exactly 24
-h <- rep(h, length = 24)
+h <- rep(h, length.out = 24)
Z. <- Z ## the result is the same as
Z <- h; dim(Z) <- c(3,4,2)
stopifnot(identical(Z., Z))
@@ -324,7 +324,7 @@ hist(eruptions)
##
postscript("images/hist.eps", ...)
# make the bins smaller, make a plot of density
-hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE)
+hist(eruptions, seq(1.6, 5.2, 0.2), probability=TRUE)
lines(density(eruptions, bw=0.1))
rug(eruptions) # show the actual data points
## dev.off()
@@ -393,7 +393,7 @@ plot(ecdf(B), do.points=FALSE, verticals=TRUE, add=TRUE)
###--- @appendix A sample session
## "Simulate starting a new R session, by
-rm(list=ls(all=TRUE))
+rm(list=ls(all.names=TRUE))
set.seed(123) # for repeatability
if(interactive())
@@ -410,7 +410,7 @@ dummy <- data.frame(x = x, y = x + rnorm(x)*w)
dummy
fm <- lm(y ~ x, data=dummy)
summary(fm)
-fm1 <- lm(y ~ x, data=dummy, weight=1/w^2)
+fm1 <- lm(y ~ x, data=dummy, weights=1/w^2)
summary(fm1)
attach(dummy)
lrf <- lowess(x, y)
@@ -444,7 +444,7 @@ anova(fm0, fm)
detach()
rm(fm, fm0)
-x <- seq(-pi, pi, len=50)
+x <- seq(-pi, pi, length.out=50)
y <- x
f <- outer(x, y, function(x, y) cos(y)/(1 + x^2))
oldpar <- par(no.readonly = TRUE)
@@ -457,7 +457,7 @@ par(oldpar)
image(x, y, f)
image(x, y, fa)
objects(); rm(x, y, f, fa)
-th <- seq(-pi, pi, len=100)
+th <- seq(-pi, pi, length.out=100)
z <- exp(1i*th)
par(pty="s")
plot(z, type="l")
diff --git a/src/library/base/demo/error.catching.R b/src/library/base/demo/error.catching.R
index b69ee509185..f41f8a486fe 100644
--- a/src/library/base/demo/error.catching.R
+++ b/src/library/base/demo/error.catching.R
@@ -51,7 +51,7 @@ withWarnings <- function(expr) {
withWarnings({ warning("first"); warning("2nd"); pi })
r <- withWarnings({ log(-1) + sqrt(-4); exp(1) })
-str(r, digits=14)
+str(r, digits.d=14)
##' @title tryCatch *all* warnings and messages, and an error or the final value
##' @param expr an \R expression to evaluate
diff --git a/src/library/base/demo/is.things.R b/src/library/base/demo/is.things.R
index 65e356ef501..83b262d968a 100644
--- a/src/library/base/demo/is.things.R
+++ b/src/library/base/demo/is.things.R
@@ -7,7 +7,7 @@
xtraBaseNms <- c("last.dump", "last.warning", ".Last.value",
".Random.seed", ".Traceback")
ls.base <- Filter(function(nm) is.na(match(nm, xtraBaseNms)),
- ls("package:base", all=TRUE))
+ ls("package:base", all.names=TRUE))
base.is.f <- sapply(ls.base, function(x) is.function(get(x)))
cat("\nNumber of all base objects:\t", length(ls.base),
"\nNumber of functions from these:\t", sum(base.is.f),
@@ -129,9 +129,9 @@ is0
ispi <- unlist(is.ALL(pi))
all(ispi[is0.ok] == is0)
-is.ALL(numeric(0), true=TRUE)
-is.ALL(array(1,1:3), true=TRUE)
-is.ALL(cbind(1:3), true=TRUE)
+is.ALL(numeric(0), true.only=TRUE)
+is.ALL(array(1,1:3), true.only=TRUE)
+is.ALL(cbind(1:3), true.only=TRUE)
is.ALL(structure(1:7, names = paste("a",1:7,sep="")))
is.ALL(structure(1:7, names = paste("a",1:7,sep="")), true.only = TRUE)
diff --git a/src/library/datasets/data/iris.R b/src/library/datasets/data/iris.R
index 68b7f325405..9fdda063082 100644
--- a/src/library/datasets/data/iris.R
+++ b/src/library/datasets/data/iris.R
@@ -42,4 +42,4 @@ Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2,
2.2, 2.3, 1.5, 2.3, 2, 2, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2, 2.2,
1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2,
2.3, 1.8),
-Species = gl(3,50, label = c("setosa", "versicolor", "virginica")))
+Species = gl(3,50, labels = c("setosa", "versicolor", "virginica")))
diff --git a/src/library/datasets/data/state.R b/src/library/datasets/data/state.R
index 3388e68bb7f..0e71e1da63b 100644
--- a/src/library/datasets/data/state.R
+++ b/src/library/datasets/data/state.R
@@ -60,7 +60,7 @@ factor(c(4, 9, 8, 5, 9, 8, 1, 3, 3, 3, 9, 8, 6, 6, 7, 7, 4, 5,
factor(c(2, 4, 4, 2, 4, 4, 1, 2, 2, 2, 4, 4, 3, 3, 3, 3, 2, 2,
1, 2, 1, 3, 3, 2, 3, 4, 3, 4, 1, 1, 4, 1, 2, 3, 3, 2, 4, 1, 1, 2, 3, 2,
2, 4, 1, 2, 4, 2, 3, 4), levels=1:4,
-label = c("Northeast", "South", "North Central", "West"))
+labels = c("Northeast", "South", "North Central", "West"))
"state.x77" <-
structure(c(3615, 365, 2212, 2110, 21198, 2541, 3100, 579, 8277, 4931,
diff --git a/src/library/graphics/demo/graphics.R b/src/library/graphics/demo/graphics.R
index 009a8ac7c27..5ccd15d946a 100644
--- a/src/library/graphics/demo/graphics.R
+++ b/src/library/graphics/demo/graphics.R
@@ -87,7 +87,7 @@ rect(usr[1], usr[3], usr[2], usr[4], col="cornsilk", border="black")
lines(x, col="blue")
points(x, pch=21, bg="lightcyan", cex=1.25)
axis(2, col.axis="blue", las=1)
-axis(1, at=1:12, lab=month.abb, col.axis="blue")
+axis(1, at=1:12, labels=month.abb, col.axis="blue")
box()
title(main= "The Level of Interest in R", font.main=4, col.main="red")
title(xlab= "1996", col.lab="red")
diff --git a/src/library/grid/R/group.R b/src/library/grid/R/group.R
index 413ef50af14..d51379a63ee 100644
--- a/src/library/grid/R/group.R
+++ b/src/library/grid/R/group.R
@@ -26,8 +26,8 @@ finaliseGroup <- function(x) {
##
## Justification of the current viewport must also be preserved
## so that transformation on group use is calculated correctly.
- hjust <- resolveHJust(cvp$just, cvp$hjust)
- vjust <- resolveVJust(cvp$just, cvp$vjust)
+ hjust <- resolveHJust(cvp$justification, cvp$hjust)
+ vjust <- resolveVJust(cvp$justification, cvp$vjust)
pushViewport(viewport(hjust, vjust,
just=c(hjust, vjust),
mask="none",
@@ -40,8 +40,8 @@ finaliseGroup <- function(x) {
if (is.grob(x$dst)) {
destination <- function() {
cvp <- current.viewport()
- hjust <- resolveHJust(cvp$just, cvp$hjust)
- vjust <- resolveVJust(cvp$just, cvp$vjust)
+ hjust <- resolveHJust(cvp$justification, cvp$hjust)
+ vjust <- resolveVJust(cvp$justification, cvp$vjust)
pushViewport(viewport(hjust, vjust,
just=c(hjust, vjust),
mask="none",
@@ -80,11 +80,11 @@ recordGroup <- function(x, ref) {
group <- list(ref=ref,
## Record location, size, angle for re-use in
## different viewport
- xy=deviceLoc(unit(resolveHJust(cvp$just, cvp$hjust), "npc"),
- unit(resolveVJust(cvp$just, cvp$vjust), "npc"),
+ xy=deviceLoc(unit(resolveHJust(cvp$justification, cvp$hjust), "npc"),
+ unit(resolveVJust(cvp$justification, cvp$vjust), "npc"),
valueOnly=TRUE, device=TRUE),
- xyin=deviceLoc(unit(resolveHJust(cvp$just, cvp$hjust), "npc"),
- unit(resolveVJust(cvp$just, cvp$vjust), "npc"),
+ xyin=deviceLoc(unit(resolveHJust(cvp$justification, cvp$hjust), "npc"),
+ unit(resolveVJust(cvp$justification, cvp$vjust), "npc"),
valueOnly=TRUE, device=FALSE),
wh=c(convertX(unit(1, "npc"), "in", valueOnly=TRUE),
convertY(unit(1, "npc"), "in", valueOnly=TRUE)),
@@ -134,8 +134,8 @@ defnTranslate <- function(group, inverse=FALSE, device=TRUE) {
useTranslate <- function(inverse=FALSE, device=TRUE) {
cvp <- current.viewport()
- xy <- deviceLoc(unit(resolveHJust(cvp$just, cvp$hjust), "npc"),
- unit(resolveVJust(cvp$just, cvp$vjust), "npc"),
+ xy <- deviceLoc(unit(resolveHJust(cvp$justification, cvp$hjust), "npc"),
+ unit(resolveVJust(cvp$justification, cvp$vjust), "npc"),
valueOnly=TRUE, device=device)
if (inverse) {
groupTranslate(-xy$x, -xy$y)
diff --git a/src/library/grid/tests/testls.R b/src/library/grid/tests/testls.R
index f651ef432a9..a1f3cf570c7 100644
--- a/src/library/grid/tests/testls.R
+++ b/src/library/grid/tests/testls.R
@@ -28,103 +28,103 @@ grid.ls(gTree(children=gList(grob(name="child1"), grob(name="child1")),
###########
# Plain viewport
grid.ls(viewport(name="vp1"),
- view=TRUE)
+ viewports=TRUE)
# vpList
grid.ls(vpList(viewport(name="vpl1")),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpList(viewport(name="vpl1"), viewport(name="vpl2")),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpList(viewport(name="vpl1"), viewport(name="vpl2"),
viewport(name="vpl3")),
- view=TRUE)
+ viewports=TRUE)
# vpStack
grid.ls(vpStack(viewport(name="vps1"), viewport(name="vps2")),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpStack(viewport(name="vps1"), viewport(name="vps2"),
viewport(name="vps3")),
- view=TRUE)
+ viewports=TRUE)
# vpTrees
grid.ls(vpTree(viewport(name="parentvp"), vpList(viewport(name="childvp"))),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpTree(viewport(name="parentvp"),
vpList(viewport(name="cvp1"), viewport(name="cvp2"))),
- view=TRUE)
+ viewports=TRUE)
# vpPaths
grid.ls(vpPath("A"),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpPath("A", "B"),
- view=TRUE)
+ viewports=TRUE)
grid.ls(vpPath("A", "B", "C"),
- view=TRUE)
+ viewports=TRUE)
##########
# MIXTURES
##########
# grob with vp viewport
g1 <- grob(vp=viewport(name="gvp"), name="g1")
-grid.ls(g1, view=TRUE, full=TRUE)
-grid.ls(g1, view=TRUE, full=TRUE, grob=FALSE)
+grid.ls(g1, viewports=TRUE, fullNames=TRUE)
+grid.ls(g1, viewports=TRUE, fullNames=TRUE, grobs=FALSE)
# grob with vp vpList
grid.ls(grob(vp=vpList(viewport(name="vpl")), name="g1"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(grob(vp=vpList(viewport(name="vpl1"), viewport(name="vpl2")),
name="g1"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
# grob with vp vpStack
grid.ls(grob(vp=vpStack(viewport(name="vps1"), viewport(name="vps2")),
name="g1"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(grob(vp=vpStack(viewport(name="vps1"), viewport(name="vps2"),
viewport(name="vps3")),
name="g1"),
- view=TRUE)
+ viewports=TRUE)
# grob with vp vpTree
grid.ls(grob(vp=vpTree(viewport(name="parentvp"),
vpList(viewport(name="cvp"))),
name="g1"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(grob(vp=vpTree(viewport(name="parentvp"),
vpList(viewport(name="cvp1"), viewport(name="cvp2"))),
name="g1"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
# gTree with vp viewport
# and child grob with vp viewport
grid.ls(gTree(children=gList(grob(vp=viewport(name="childvp"), name="cg1"),
grob(name="cg2")),
name="parent",
vp=viewport(name="parentvp")),
- view=TRUE)
+ viewports=TRUE)
# gTree with childrenvp viewport
grid.ls(gTree(childrenvp=viewport(name="vp"), name="gtree"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(gTree(childrenvp=viewport(name="vp"), name="gtree"),
- view=TRUE, full=TRUE, grob=FALSE)
+ viewports=TRUE, fullNames=TRUE, grobs=FALSE)
grid.ls(gTree(children=gList(grob(name="child")),
name="parent",
childrenvp=viewport(name="vp")),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(gTree(children=gList(grob(name="child1"), grob(name="child2")),
name="parent",
childrenvp=viewport(name="vp")),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(gTree(children=gList(grob(name="child")),
childrenvp=viewport(name="vp"),
name="parent"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(gTree(children=gList(grob(name="child1"), grob(name="child2")),
name="parent",
childrenvp=viewport(name="vp")),
- view=TRUE, full=TRUE, grob=FALSE)
+ viewports=TRUE, fullNames=TRUE, grobs=FALSE)
# gTree with childrenvp vpTree
grid.ls(gTree(childrenvp=vpTree(parent=viewport(name="vp1"),
children=vpList(viewport(name="vp2"))),
name="gtree"),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
grid.ls(gTree(children=gList(grob(name="child")),
name="parent",
childrenvp=vpTree(parent=viewport(name="vp1"),
children=vpList(viewport(name="vp2")))),
- view=TRUE, full=TRUE)
+ viewports=TRUE, fullNames=TRUE)
# gTree with childrenvp vpTree
# and child grob with vp vpPath
# A gTree, called "parent", with childrenvp vpTree (vp2 within vp1)
@@ -135,24 +135,24 @@ sampleGTree <- gTree(name="parent",
children=vpList(viewport(name="vp2"))))
grid.ls(sampleGTree)
# Show viewports too
-grid.ls(sampleGTree, view=TRUE)
+grid.ls(sampleGTree, viewports=TRUE)
# Only show viewports
-grid.ls(sampleGTree, view=TRUE, grob=FALSE)
+grid.ls(sampleGTree, viewports=TRUE, grobs=FALSE)
# Alternate displays
# nested listing, custom indent
-grid.ls(sampleGTree, view=TRUE, print=nestedListing, gindent="--")
+grid.ls(sampleGTree, viewports=TRUE, print=nestedListing, gindent="--")
# path listing
-grid.ls(sampleGTree, view=TRUE, print=pathListing)
+grid.ls(sampleGTree, viewports=TRUE, print=pathListing)
# path listing, without grobs aligned
-grid.ls(sampleGTree, view=TRUE, print=pathListing, gAlign=FALSE)
+grid.ls(sampleGTree, viewports=TRUE, print=pathListing, gAlign=FALSE)
# grob path listing
-grid.ls(sampleGTree, view=TRUE, print=grobPathListing)
+grid.ls(sampleGTree, viewports=TRUE, print=grobPathListing)
# path listing, grobs only
grid.ls(sampleGTree, print=pathListing)
# path listing, viewports only
-grid.ls(sampleGTree, view=TRUE, grob=FALSE, print=pathListing)
+grid.ls(sampleGTree, viewports=TRUE, grobs=FALSE, print=pathListing)
# raw flat listing
-str(grid.ls(sampleGTree, view=TRUE, print=FALSE))
+str(grid.ls(sampleGTree, viewports=TRUE, print=FALSE))
diff --git a/src/library/grid/tests/testls.Rout.save b/src/library/grid/tests/testls.Rout.save
index 137cd0a615e..cba8a91d247 100644
--- a/src/library/grid/tests/testls.Rout.save
+++ b/src/library/grid/tests/testls.Rout.save
@@ -56,20 +56,20 @@ parent
> ###########
> # Plain viewport
> grid.ls(viewport(name="vp1"),
-+ view=TRUE)
++ viewports=TRUE)
vp1
> # vpList
> grid.ls(vpList(viewport(name="vpl1")),
-+ view=TRUE)
++ viewports=TRUE)
vpl1
> grid.ls(vpList(viewport(name="vpl1"), viewport(name="vpl2")),
-+ view=TRUE)
++ viewports=TRUE)
vpl1
1
vpl2
> grid.ls(vpList(viewport(name="vpl1"), viewport(name="vpl2"),
+ viewport(name="vpl3")),
-+ view=TRUE)
++ viewports=TRUE)
vpl1
1
vpl2
@@ -77,37 +77,37 @@ vpl2
vpl3
> # vpStack
> grid.ls(vpStack(viewport(name="vps1"), viewport(name="vps2")),
-+ view=TRUE)
++ viewports=TRUE)
vps1
vps2
> grid.ls(vpStack(viewport(name="vps1"), viewport(name="vps2"),
+ viewport(name="vps3")),
-+ view=TRUE)
++ viewports=TRUE)
vps1
vps2
vps3
> # vpTrees
> grid.ls(vpTree(viewport(name="parentvp"), vpList(viewport(name="childvp"))),
-+ view=TRUE)
++ viewports=TRUE)
parentvp
childvp
> grid.ls(vpTree(viewport(name="parentvp"),
+ vpList(viewport(name="cvp1"), viewport(name="cvp2"))),
-+ view=TRUE)
++ viewports=TRUE)
parentvp
cvp1
1
cvp2
> # vpPaths
> grid.ls(vpPath("A"),
-+ view=TRUE)
++ viewports=TRUE)
A
> grid.ls(vpPath("A", "B"),
-+ view=TRUE)
++ viewports=TRUE)
A
B
> grid.ls(vpPath("A", "B", "C"),
-+ view=TRUE)
++ viewports=TRUE)
A
B
C
@@ -117,22 +117,22 @@ A
> ##########
> # grob with vp viewport
> g1 <- grob(vp=viewport(name="gvp"), name="g1")
-> grid.ls(g1, view=TRUE, full=TRUE)
+> grid.ls(g1, viewports=TRUE, fullNames=TRUE)
viewport[gvp]
grob[g1]
upViewport[1]
-> grid.ls(g1, view=TRUE, full=TRUE, grob=FALSE)
+> grid.ls(g1, viewports=TRUE, fullNames=TRUE, grobs=FALSE)
viewport[gvp]
upViewport[1]
> # grob with vp vpList
> grid.ls(grob(vp=vpList(viewport(name="vpl")), name="g1"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
viewport[vpl]
grob[g1]
upViewport[1]
> grid.ls(grob(vp=vpList(viewport(name="vpl1"), viewport(name="vpl2")),
+ name="g1"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
viewport[vpl1]
upViewport[1]
viewport[vpl2]
@@ -141,7 +141,7 @@ viewport[vpl2]
> # grob with vp vpStack
> grid.ls(grob(vp=vpStack(viewport(name="vps1"), viewport(name="vps2")),
+ name="g1"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
viewport[vps1]
viewport[vps2]
grob[g1]
@@ -149,7 +149,7 @@ viewport[vps1]
> grid.ls(grob(vp=vpStack(viewport(name="vps1"), viewport(name="vps2"),
+ viewport(name="vps3")),
+ name="g1"),
-+ view=TRUE)
++ viewports=TRUE)
vps1
vps2
vps3
@@ -159,7 +159,7 @@ vps1
> grid.ls(grob(vp=vpTree(viewport(name="parentvp"),
+ vpList(viewport(name="cvp"))),
+ name="g1"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
viewport[parentvp]
viewport[cvp]
grob[g1]
@@ -167,7 +167,7 @@ viewport[parentvp]
> grid.ls(grob(vp=vpTree(viewport(name="parentvp"),
+ vpList(viewport(name="cvp1"), viewport(name="cvp2"))),
+ name="g1"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
viewport[parentvp]
viewport[cvp1]
upViewport[1]
@@ -180,7 +180,7 @@ viewport[parentvp]
+ grob(name="cg2")),
+ name="parent",
+ vp=viewport(name="parentvp")),
-+ view=TRUE)
++ viewports=TRUE)
parentvp
parent
childvp
@@ -190,18 +190,18 @@ parentvp
1
> # gTree with childrenvp viewport
> grid.ls(gTree(childrenvp=viewport(name="vp"), name="gtree"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[gtree]
viewport[vp]
upViewport[1]
> grid.ls(gTree(childrenvp=viewport(name="vp"), name="gtree"),
-+ view=TRUE, full=TRUE, grob=FALSE)
++ viewports=TRUE, fullNames=TRUE, grobs=FALSE)
viewport[vp]
upViewport[1]
> grid.ls(gTree(children=gList(grob(name="child")),
+ name="parent",
+ childrenvp=viewport(name="vp")),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[parent]
viewport[vp]
upViewport[1]
@@ -209,7 +209,7 @@ gTree[parent]
> grid.ls(gTree(children=gList(grob(name="child1"), grob(name="child2")),
+ name="parent",
+ childrenvp=viewport(name="vp")),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[parent]
viewport[vp]
upViewport[1]
@@ -218,7 +218,7 @@ gTree[parent]
> grid.ls(gTree(children=gList(grob(name="child")),
+ childrenvp=viewport(name="vp"),
+ name="parent"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[parent]
viewport[vp]
upViewport[1]
@@ -226,14 +226,14 @@ gTree[parent]
> grid.ls(gTree(children=gList(grob(name="child1"), grob(name="child2")),
+ name="parent",
+ childrenvp=viewport(name="vp")),
-+ view=TRUE, full=TRUE, grob=FALSE)
++ viewports=TRUE, fullNames=TRUE, grobs=FALSE)
viewport[vp]
upViewport[1]
> # gTree with childrenvp vpTree
> grid.ls(gTree(childrenvp=vpTree(parent=viewport(name="vp1"),
+ children=vpList(viewport(name="vp2"))),
+ name="gtree"),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[gtree]
viewport[vp1]
viewport[vp2]
@@ -242,7 +242,7 @@ gTree[gtree]
+ name="parent",
+ childrenvp=vpTree(parent=viewport(name="vp1"),
+ children=vpList(viewport(name="vp2")))),
-+ view=TRUE, full=TRUE)
++ viewports=TRUE, fullNames=TRUE)
gTree[parent]
viewport[vp1]
viewport[vp2]
@@ -260,7 +260,7 @@ gTree[parent]
parent
child
> # Show viewports too
-> grid.ls(sampleGTree, view=TRUE)
+> grid.ls(sampleGTree, viewports=TRUE)
parent
vp1
vp2
@@ -270,7 +270,7 @@ parent
child
2
> # Only show viewports
-> grid.ls(sampleGTree, view=TRUE, grob=FALSE)
+> grid.ls(sampleGTree, viewports=TRUE, grobs=FALSE)
vp1
vp2
2
@@ -279,7 +279,7 @@ vp1
2
> # Alternate displays
> # nested listing, custom indent
-> grid.ls(sampleGTree, view=TRUE, print=nestedListing, gindent="--")
+> grid.ls(sampleGTree, viewports=TRUE, print=nestedListing, gindent="--")
parent
--vp1
----vp2
@@ -289,7 +289,7 @@ parent
------child
------2
> # path listing
-> grid.ls(sampleGTree, view=TRUE, print=pathListing)
+> grid.ls(sampleGTree, viewports=TRUE, print=pathListing)
| parent
vp1
vp1::vp2
@@ -299,7 +299,7 @@ vp1::vp2
vp1::vp2 | parent::child
vp1::vp2::2
> # path listing, without grobs aligned
-> grid.ls(sampleGTree, view=TRUE, print=pathListing, gAlign=FALSE)
+> grid.ls(sampleGTree, viewports=TRUE, print=pathListing, gAlign=FALSE)
| parent
vp1
vp1::vp2
@@ -309,7 +309,7 @@ vp1::vp2
vp1::vp2 | parent::child
vp1::vp2::2
> # grob path listing
-> grid.ls(sampleGTree, view=TRUE, print=grobPathListing)
+> grid.ls(sampleGTree, viewports=TRUE, print=grobPathListing)
| parent
vp1::vp2 | parent::child
> # path listing, grobs only
@@ -317,7 +317,7 @@ vp1::vp2 | parent::child
| parent
| parent::child
> # path listing, viewports only
-> grid.ls(sampleGTree, view=TRUE, grob=FALSE, print=pathListing)
+> grid.ls(sampleGTree, viewports=TRUE, grobs=FALSE, print=pathListing)
vp1
vp1::vp2
vp1::vp2::2
@@ -325,7 +325,7 @@ vp1
vp1::vp2
vp1::vp2::2
> # raw flat listing
-> str(grid.ls(sampleGTree, view=TRUE, print=FALSE))
+> str(grid.ls(sampleGTree, viewports=TRUE, print=FALSE))
List of 6
$ name : chr [1:8] "parent" "vp1" "vp2" "2" ...
$ gDepth : num [1:8] 0 1 1 1 1 1 1 1
diff --git a/src/library/methods/man/hasArg.Rd b/src/library/methods/man/hasArg.Rd
index bf32b3021bd..b5b6431d40e 100644
--- a/src/library/methods/man/hasArg.Rd
+++ b/src/library/methods/man/hasArg.Rd
@@ -39,6 +39,8 @@ ftest(1) ## c(TRUE, FALSE)
ftest(1, 2) ## c(TRUE, FALSE)
ftest(y2 = 2) ## c(FALSE, TRUE)
ftest(y = 2) ## c(FALSE, FALSE) (no partial matching)
+\dontshow{ old <- options(warnPartialMatchArgs=FALSE) }
ftest(y2 = 2, x = 1) ## c(TRUE, TRUE) partial match x1
+\dontshow{ options(old) }
}
\keyword{ programming }
diff --git a/src/library/stats/demo/smooth.R b/src/library/stats/demo/smooth.R
index 563974f8aa5..591d1765047 100644
--- a/src/library/stats/demo/smooth.R
+++ b/src/library/stats/demo/smooth.R
@@ -10,9 +10,9 @@ example(smooth, package="stats")
## Didactical investigation:
showSmooth <- function(x, leg.x = 1, leg.y = max(x)) {
- ss <- cbind(x, "3c" = smooth(x, "3", end="copy"),
+ ss <- cbind(x, "3c" = smooth(x, "3", endrule="copy"),
"3" = smooth(x, "3"),
- "3Rc" = smooth(x, "3R", end="copy"),
+ "3Rc" = smooth(x, "3R", endrule="copy"),
"3R" = smooth(x, "3R"),
sm = smooth(x))
k <- ncol(ss) - 1
diff --git a/src/library/stats/man/lmfit.Rd b/src/library/stats/man/lmfit.Rd
index 412d81c6fef..06469b70f2b 100644
--- a/src/library/stats/man/lmfit.Rd
+++ b/src/library/stats/man/lmfit.Rd
@@ -95,8 +95,8 @@ str(lm. <- lm.fit (x = X, y = y))
lm.. <- .lm.fit(X,y)
lm.w <- .lm.fit(X*sqrt(w), y*sqrt(w))
id <- function(x, y) all.equal(x, y, tolerance = 1e-15, scale = 1)
- stopifnot(id(unname(lm.$coef), lm..$coef),
- id(unname(lmw$coef), lm.w$coef))
+ stopifnot(id(unname(lm.$coefficients), lm..$coefficients),
+ id(unname(lmw$coefficients), lm.w$coefficients))
}
## fits w/o intercept:
all.equal(unname(coef(lm(y ~ X-1))),
diff --git a/src/library/stats/tests/arimaML.R b/src/library/stats/tests/arimaML.R
index 90e89ecad41..e2d1b3cf747 100644
--- a/src/library/stats/tests/arimaML.R
+++ b/src/library/stats/tests/arimaML.R
@@ -126,10 +126,10 @@ chkQ0 <- function(phi,theta, tol=.Machine$double.eps^0.5,
eig <- if(doEigen) rbind("0" = EV.k(Q0), bis = EV.k(Q0bis), ter = EV.k(Q0ter))
## else NULL
- a.eq <- list(cRC = all.equal(Q0bis,Q0bisC(phi,theta), tol= tolC),
- c12 = all.equal(Q0, Q0bis, tol=tol),
- c13 = all.equal(Q0, Q0ter, tol=tol),
- c23 = all.equal(Q0bis,Q0ter, tol=tol))
+ a.eq <- list(cRC = all.equal(Q0bis,Q0bisC(phi,theta), tolerance= tolC),
+ c12 = all.equal(Q0, Q0bis, tolerance=tol),
+ c13 = all.equal(Q0, Q0ter, tolerance=tol),
+ c23 = all.equal(Q0bis,Q0ter, tolerance=tol))
if(strict) do.call(stopifnot, a.eq)
invisible(list(Q0 = Q0, Q0bis = Q0bis, Q0ter = Q0ter,
all.eq = a.eq, eigen = eig))
@@ -197,7 +197,7 @@ ini.ph <- true.cf
## Default method = "CSS-ML" works fine
fm1 <- arima(x, order= c(1,0,1), seasonal= list(period=12, order=c(1,0,0)),
include.mean=FALSE, init=ini.ph)
-stopifnot(all.equal(true.cf, coef(fm1), tol = 0.05))
+stopifnot(all.equal(true.cf, coef(fm1), tolerance = 0.05))
## Using 'ML' seems "harder" :
e1 <- try(
@@ -222,7 +222,7 @@ arima(x, order= c(1,0,1), seasonal= list(period=12, order=c(1,0,0)),
include.mean=FALSE, init=ini.ph, method='ML', SSinit = "Rossi", transform.p=FALSE)
stopifnot(all.equal(confint(fm1),
- confint(fm2), tol = 4e-4))
+ confint(fm2), tolerance = 4e-4))
###---------- PR#16278 --------------------------------------
@@ -236,7 +236,7 @@ V. <- var(diff(x)) * (n-2) / (n-1) # 4.640e-5 : ML
f00 <- arima0(x, c(0,1,0), method="ML", xreg=1:n)
(fit1 <- arima (x, c(0,1,0), method="ML", xreg=1:n))
stopifnot(all.equal(fit1$sigma2, V.), fit1$nobs == n-1,
- all.equal(fit1$loglik, 14.28, tol=4e-4),
+ all.equal(fit1$loglik, 14.28, tolerance=4e-4),
all.equal(f00$sigma2, fit1$sigma2),
all.equal(f00$loglik, fit1$loglik))
@@ -250,16 +250,16 @@ xr <- poly(x., 3)
x. <- cumsum(cumsum(cumsum(x.))) + xr %*% 10^(0:2)
(fit3 <- arima (x., c(0,3,0), method="ML", xreg = xr))
stopifnot(fit3$ nobs == n-3,
- all.equal(fit3$ sigma2, 0.00859843, tol = 1e-6),
- all.equal(fit3$ loglik, 22.06043, tol = 1e-6),
+ all.equal(fit3$ sigma2, 0.00859843, tolerance = 1e-6),
+ all.equal(fit3$ loglik, 22.06043, tolerance = 1e-6),
all.equal(unname(coef(fit3)),
- c(0.70517, 9.9415, 100.106), tol = 1e-5))
+ c(0.70517, 9.9415, 100.106), tolerance = 1e-5))
x.[5:6] <- NA
(fit3N <- arima (x., c(0,3,0), method="ML", xreg = xr))
stopifnot(fit3N$ nobs == n-3-2, # == #{obs} - d - #{NA}
- all.equal(fit3N$ sigma2, 0.009297345, tol = 1e-6),
- all.equal(fit3N$ loglik, 16.73918, tol = 1e-6),
+ all.equal(fit3N$ sigma2, 0.009297345, tolerance = 1e-6),
+ all.equal(fit3N$ loglik, 16.73918, tolerance = 1e-6),
all.equal(unname(coef(fit3N)),
- c(0.64904, 9.92660, 100.126), tol = 1e-5))
+ c(0.64904, 9.92660, 100.126), tolerance = 1e-5))
diff --git a/src/library/stats/tests/density_chk.R b/src/library/stats/tests/density_chk.R
index 9765e665470..938f22d1400 100644
--- a/src/library/stats/tests/density_chk.R
+++ b/src/library/stats/tests/density_chk.R
@@ -31,8 +31,8 @@ chkDens <- function(x, n=512, verbose=TRUE, plot=verbose) {
stopifnot(exprs = {
identical(den0$x, den$x)
any(inI <- min(x) <= den$x & den$x <= max(x))
- all.equal(den$y[inI], den0$y[inI]*corr0, tol = tolN ) # 5.878e-5
- all.equal(den$y , den0$y *corr0, tol = tolN2) # 9.48 e-5
+ all.equal(den$y[inI], den0$y[inI]*corr0, tolerance = tolN ) # 5.878e-5
+ all.equal(den$y , den0$y *corr0, tolerance = tolN2) # 9.48 e-5
})
## exact integration to 1 : .. compute density further out:
diff --git a/src/library/stats/tests/glm-etc.R b/src/library/stats/tests/glm-etc.R
index 75d391463f5..51cbdc5163f 100644
--- a/src/library/stats/tests/glm-etc.R
+++ b/src/library/stats/tests/glm-etc.R
@@ -17,7 +17,7 @@ stopifnot(names(which(!jj)) == "am1:mpg"
, all.equal(V2[jj,jj], vcov(fm2, complete=FALSE))
, all.equal(c2[jj], c(`(Intercept)`= 626.0915, am1 = -249.4183,
mpg = -33.74701, mpg_c = 10.97014),
- tol = 7e-7)# 1.01e-7 [F26 Lnx 64b]
+ tolerance = 7e-7)# 1.01e-7 [F26 Lnx 64b]
)
@@ -61,7 +61,7 @@ tools::assertWarning(pN.<- predict(mod1234, new.x, rankdeficient = "NAwarn"))
(pne <- predict(mod1234, new.x, rankdeficient = "non-estim"))
stopifnot(exprs = {
identical(pN, pN.)
- all.equal(fitted(mod1234), ps1, tol = 2e-15) # seen 3.11e-16
+ all.equal(fitted(mod1234), ps1, tolerance = 2e-15) # seen 3.11e-16
identical(i.ne <- attr(pne, "non-estim"),
c(B = 2L, E = 5L, F = 6L))
which(!new.ok) == i.ne
@@ -86,16 +86,16 @@ d8 <- data.frame(
-899999988, -300000004, 900000012, 450000006, 2))
coef(fm8. <- lm(y ~ . -1, data = d8)) # the one for X3 is NA
cf8. <- c(X1 = -1.999854802642, X2 = 3.499496934397, X3 = NA)
- all.equal(cf8., coef(fm8.), tol=0)# -> "Mean rel..diff.: ~ 3e-15
+ all.equal(cf8., coef(fm8.), tolerance=0)# -> "Mean rel..diff.: ~ 3e-15
stopifnot(all.equal(cf8., coef(fm8.)))
coef(fm8.9 <- lm(y ~ . -1, data = d8, tol = 1e-9)) # no NA , but "instable" -- not too precise
cf8.9 <- c(X1 = 45822.830422, X2 = -22908.915871, X3 = 45824.830295)
-all.equal(cf8.9, coef(fm8.9), tol=0)# -> "Mean rel..diff.: 5.3e-9 | 5.15e-12
+all.equal(cf8.9, coef(fm8.9), tolerance=0)# -> "Mean rel..diff.: 5.3e-9 | 5.15e-12
## was < 2e-8 in R 4.2.2
## x86_64 Linux/gcc12 gives ca 5e-12
## vanilla M1mac gives 6.16e-11, Accelerate on M1 macOS gives 3.99e-10;
## Debian with "generic" (i.e. not R's) BLAS/Lapack *still* gave 5.2985e-09 (?!)
-stopifnot(all.equal(cf8.9, coef(fm8.9), tol = 7e-9))
+stopifnot(all.equal(cf8.9, coef(fm8.9), tolerance = 7e-9))
## predict :
nd <- d8[,-1] + rep(outer(c(-2:2),10^(1:3)), 3) # 5 * 9 = 45 = 15 * 3 (nrow * ncol)
@@ -108,7 +108,7 @@ pN <- predict(fm8. , newdata=nd, rankdeficient = "NA")
pne <- predict(fm8. , newdata=nd, rankdeficient = "non-estim")
p.9 <- predict(fm8.9, newdata=nd)
print(digits=9, cbind(ps, pne, pN, p.9))
-all.equal(p.9, ps, tol=0)# 0.035..
+all.equal(p.9, ps, tolerance=0)# 0.035..
dropAtt <- function(x) `attributes<-`(x, NULL)
stopifnot(exprs = {
ps == ps. # numbers;
diff --git a/src/library/stats/tests/ks-test.R b/src/library/stats/tests/ks-test.R
index fe68a53d4dd..3cdcd2a8ede 100644
--- a/src/library/stats/tests/ks-test.R
+++ b/src/library/stats/tests/ks-test.R
@@ -72,10 +72,10 @@ sapply(pv$s0, unlist)
sapply(pv$s., unlist) # not really close, but ..
pv$s0$two.sided[1] <- 1 ## artificially
-stopifnot(all.equal(pv$s0, pv$s., tol = 0.5 + 1e-6), # seen 0.5
+stopifnot(all.equal(pv$s0, pv$s., tolerance = 0.5 + 1e-6), # seen 0.5
## "less" are close:
all.equal(unlist(pv[[c("s0","less")]]),
- unlist(pv[[c("s.","less")]]), tol = 0.03),
+ unlist(pv[[c("s.","less")]]), tolerance = 0.03),
0 <= unlist(pv), unlist(pv) <= 1) # <- no further NA ..
## b)
sapply(stR[["statistic"]], unlist)
diff --git a/src/library/stats/tests/ks-test.Rout.save b/src/library/stats/tests/ks-test.Rout.save
index 385ffc2c061..c6b1eb6a12c 100644
--- a/src/library/stats/tests/ks-test.Rout.save
+++ b/src/library/stats/tests/ks-test.Rout.save
@@ -225,10 +225,10 @@ character(0)
[5,] 0.0625 1 0.03125
>
> pv$s0$two.sided[1] <- 1 ## artificially
-> stopifnot(all.equal(pv$s0, pv$s., tol = 0.5 + 1e-6), # seen 0.5
+> stopifnot(all.equal(pv$s0, pv$s., tolerance = 0.5 + 1e-6), # seen 0.5
+ ## "less" are close:
+ all.equal(unlist(pv[[c("s0","less")]]),
-+ unlist(pv[[c("s.","less")]]), tol = 0.03),
++ unlist(pv[[c("s.","less")]]), tolerance = 0.03),
+ 0 <= unlist(pv), unlist(pv) <= 1) # <- no further NA ..
> ## b)
> sapply(stR[["statistic"]], unlist)
diff --git a/src/library/stats/tests/nls.R b/src/library/stats/tests/nls.R
index 9ac3a7c310b..7cef319f8f1 100644
--- a/src/library/stats/tests/nls.R
+++ b/src/library/stats/tests/nls.R
@@ -89,7 +89,7 @@ if(have_MASS) {
set.seed(123)
y <- x <- 1:10
yeps <- y + rnorm(length(y), sd = 0.01)
-wts <- rep(c(1, 2), length = 10); wts[5] <- 0
+wts <- rep(c(1, 2), length.out = 10); wts[5] <- 0
fit0 <- lm(yeps ~ x, weights = wts)
## IGNORE_RDIFF_BEGIN
summary(fit0, cor = TRUE)
@@ -252,7 +252,7 @@ options(op)
## scoping problems
test <- function(trace=TRUE)
{
- x <- seq(0,5,len=20)
+ x <- seq(0,5,length.out=20)
n <- 1
y <- 2*x^2 + n + rnorm(x)
xy <- data.frame(x=x,y=y)
@@ -341,7 +341,7 @@ stopifnot(all.equal(noC (nm.), noC (nmf)))
## list version (has been valid "forever", still doubtful, rather give error [FIXME] ?)
lsN <- c(as.list(dN), list(foo="bar")); lsN[["t"]] <- 1:8
nmL <- nls(`NO [µmol/l]` ~ a + k*exp(t), start=list(a=0,k=1), data = lsN)
-stopifnot(all.equal(coef(nmL), c(a = 5.069866, k = 0.003699669), tol = 4e-7))# seen 4.2e-8
+stopifnot(all.equal(coef(nmL), c(a = 5.069866, k = 0.003699669), tolerance = 4e-7))# seen 4.2e-8
## trivial RHS -- should work even w/o 'start='
fi1 <- nls(y ~ a, start = list(a=1))
@@ -378,8 +378,8 @@ errE <- Vectorize(function(eps, central=FALSE) {
curve(errE(x), 1e-9, 1e-4, log="xy", n=512, ylim = c(1.5e-11, 5e-7),
xlab = quote(epsilon), ylab=quote(errE(epsilon))) -> rex
-axis(1, at = 2^-(52/2), label = quote(sqrt(epsilon[c])), col=4, col.axis=4, line=-1/2)
-axis(1, at = 2^-(52/3), label = quote(epsilon[c]^{1/3}), col=4, col.axis=4, line=-1/2)
+axis(1, at = 2^-(52/2), labels = quote(sqrt(epsilon[c])), col=4, col.axis=4, line=-1/2)
+axis(1, at = 2^-(52/3), labels = quote(epsilon[c]^{1/3}), col=4, col.axis=4, line=-1/2)
curve(errE(x, central=TRUE), n=512, col=2, add = TRUE) -> rexC
## IGNORE_RDIFF_BEGIN
str(xy1 <- approx(rex , xout= sqrt(2^-52)) )
diff --git a/src/library/stats/tests/nls.Rout.save b/src/library/stats/tests/nls.Rout.save
index 2a99a7405f5..4672b262de4 100644
--- a/src/library/stats/tests/nls.Rout.save
+++ b/src/library/stats/tests/nls.Rout.save
@@ -136,7 +136,7 @@ c NA 0.042807
> set.seed(123)
> y <- x <- 1:10
> yeps <- y + rnorm(length(y), sd = 0.01)
-> wts <- rep(c(1, 2), length = 10); wts[5] <- 0
+> wts <- rep(c(1, 2), length.out = 10); wts[5] <- 0
> fit0 <- lm(yeps ~ x, weights = wts)
> ## IGNORE_RDIFF_BEGIN
> summary(fit0, cor = TRUE)
@@ -632,7 +632,7 @@ b NA 0.611
> ## scoping problems
> test <- function(trace=TRUE)
+ {
-+ x <- seq(0,5,len=20)
++ x <- seq(0,5,length.out=20)
+ n <- 1
+ y <- 2*x^2 + n + rnorm(x)
+ xy <- data.frame(x=x,y=y)
@@ -766,7 +766,7 @@ Warning in nls(y ~ b0[fac] + b1 * x, start = list(b0 = c(1, 1), b1 = 101), :
> ## list version (has been valid "forever", still doubtful, rather give error [FIXME] ?)
> lsN <- c(as.list(dN), list(foo="bar")); lsN[["t"]] <- 1:8
> nmL <- nls(`NO [µmol/l]` ~ a + k*exp(t), start=list(a=0,k=1), data = lsN)
-> stopifnot(all.equal(coef(nmL), c(a = 5.069866, k = 0.003699669), tol = 4e-7))# seen 4.2e-8
+> stopifnot(all.equal(coef(nmL), c(a = 5.069866, k = 0.003699669), tolerance = 4e-7))# seen 4.2e-8
>
> ## trivial RHS -- should work even w/o 'start='
> fi1 <- nls(y ~ a, start = list(a=1))
@@ -807,8 +807,8 @@ Consider specifying 'start' or using a selfStart model
>
> curve(errE(x), 1e-9, 1e-4, log="xy", n=512, ylim = c(1.5e-11, 5e-7),
+ xlab = quote(epsilon), ylab=quote(errE(epsilon))) -> rex
-> axis(1, at = 2^-(52/2), label = quote(sqrt(epsilon[c])), col=4, col.axis=4, line=-1/2)
-> axis(1, at = 2^-(52/3), label = quote(epsilon[c]^{1/3}), col=4, col.axis=4, line=-1/2)
+> axis(1, at = 2^-(52/2), labels = quote(sqrt(epsilon[c])), col=4, col.axis=4, line=-1/2)
+> axis(1, at = 2^-(52/3), labels = quote(epsilon[c]^{1/3}), col=4, col.axis=4, line=-1/2)
> curve(errE(x, central=TRUE), n=512, col=2, add = TRUE) -> rexC
> ## IGNORE_RDIFF_BEGIN
> str(xy1 <- approx(rex , xout= sqrt(2^-52)) )
diff --git a/src/library/stats/tests/simulate.R b/src/library/stats/tests/simulate.R
index d8b32d4e8c7..a61cd1d47fe 100644
--- a/src/library/stats/tests/simulate.R
+++ b/src/library/stats/tests/simulate.R
@@ -9,14 +9,14 @@ set.seed(1)
simulate(fit1, nsim = 3)
## and weights should be taken into account
-fit2 <- lm(time ~ -1 + dist + climb, hills[-18, ], weight = 1/dist^2)
+fit2 <- lm(time ~ -1 + dist + climb, hills[-18, ], weights = 1/dist^2)
coef(summary(fit2))
set.seed(1); ( ys <- simulate(fit2, nsim = 3) )
for(i in seq_len(3))
print(coef(summary(update(fit2, ys[, i] ~ .))))
## should be identical to glm(*, gaussian):
fit2. <- glm(time ~ -1 + dist + climb, family=gaussian, data=hills[-18, ],
- weight = 1/dist^2)
+ weights = 1/dist^2)
set.seed(1); ys. <- simulate(fit2., nsim = 3)
stopifnot(all.equal(ys, ys.))
diff --git a/src/library/stats/tests/simulate.Rout.save b/src/library/stats/tests/simulate.Rout.save
index ce286c82c3d..5c023393964 100644
--- a/src/library/stats/tests/simulate.Rout.save
+++ b/src/library/stats/tests/simulate.Rout.save
@@ -62,7 +62,7 @@ Cockleroi 31.5726 35.7046 35.7999
Moffat Chase 134.2882 205.1244 148.7057
>
> ## and weights should be taken into account
-> fit2 <- lm(time ~ -1 + dist + climb, hills[-18, ], weight = 1/dist^2)
+> fit2 <- lm(time ~ -1 + dist + climb, hills[-18, ], weights = 1/dist^2)
> coef(summary(fit2))
Estimate Std. Error t value Pr(>|t|)
dist 4.8999847 0.4737032 10.3440 9.8468e-12
@@ -116,7 +116,7 @@ dist 4.8215499 0.420077 11.4778 7.0162e-13
climb 0.0090388 0.001496 6.0422 9.6065e-07
> ## should be identical to glm(*, gaussian):
> fit2. <- glm(time ~ -1 + dist + climb, family=gaussian, data=hills[-18, ],
-+ weight = 1/dist^2)
++ weights = 1/dist^2)
> set.seed(1); ys. <- simulate(fit2., nsim = 3)
> stopifnot(all.equal(ys, ys.))
>
diff --git a/src/library/stats/tests/smooth.spline.R b/src/library/stats/tests/smooth.spline.R
index d2f52927b5d..7e7656fdb39 100644
--- a/src/library/stats/tests/smooth.spline.R
+++ b/src/library/stats/tests/smooth.spline.R
@@ -47,7 +47,7 @@ stopifnot(ok[e10 <= 7])
ssok <- sspl[ok]
ssGet <- function(ch) t(sapply(ssok, `[` , ch))
ssGet1 <- function(ch) sapply(ssok, `[[`, ch)
-stopifnot(all.equal(ssGet1("crit"), ssGet1("cv.crit"), tol = 1e-10))# seeing rel.diff = 6.57e-12
+stopifnot(all.equal(ssGet1("crit"), ssGet1("cv.crit"), tolerance = 1e-10))# seeing rel.diff = 6.57e-12
## Interesting: for really large lambda, solution "diverges" from the straight line
ssGet(c("lambda", "df", "crit", "pen.crit"))
diff --git a/src/library/stats/tests/ts-tests.R b/src/library/stats/tests/ts-tests.R
index 4deed43f867..8f1d06a0bc2 100644
--- a/src/library/stats/tests/ts-tests.R
+++ b/src/library/stats/tests/ts-tests.R
@@ -133,7 +133,7 @@ fr1 <- arima(ap0, c(0, 1, 1), seasonal = list(order=c(0, 1 ,1), period=12))
fr2 <- arima(ap0, c(0, 1, 1), seasonal = list(order=c(0, 1 ,1), period=12),
method = "CSS")
i <- c("coef", "sigma2", "var.coef")
-stopifnot(all.equal(fr1[i], fit[i], tol=4e-4))# 64b: 9e-5 is ok
+stopifnot(all.equal(fr1[i], fit[i], tolerance=4e-4))# 64b: 9e-5 is ok
## Structural Time Series
ap <- log10(AirPassengers) - 2
diff --git a/tests/Examples/stats-Ex.Rout.save b/tests/Examples/stats-Ex.Rout.save
index 0e9cb5cae6f..13d23a43020 100644
--- a/tests/Examples/stats-Ex.Rout.save
+++ b/tests/Examples/stats-Ex.Rout.save
@@ -9510,8 +9510,8 @@ List of 8
> lm.. <- .lm.fit(X,y)
> lm.w <- .lm.fit(X*sqrt(w), y*sqrt(w))
> id <- function(x, y) all.equal(x, y, tolerance = 1e-15, scale = 1)
-> stopifnot(id(unname(lm.$coef), lm..$coef),
-+ id(unname(lmw$coef), lm.w$coef))
+> stopifnot(id(unname(lm.$coefficients), lm..$coefficients),
++ id(unname(lmw$coefficients), lm.w$coefficients))
> ## End(Don't show)
> ## fits w/o intercept:
> all.equal(unname(coef(lm(y ~ X-1))),
diff --git a/tests/R-intro.Rout.save b/tests/R-intro.Rout.save
index a1fa72a5cdf..b8cd668d3f3 100644
--- a/tests/R-intro.Rout.save
+++ b/tests/R-intro.Rout.save
@@ -74,7 +74,7 @@ In sqrt(-17) : NaNs produced
[1] TRUE
>
> seq(-5, 5, by=.2) -> s3
-> s4 <- seq(length=51, from=-5, by=.2)
+> s4 <- seq(length.out=51, from=-5, by=.2)
> all.equal(s3,s4)
[1] TRUE
>
@@ -237,7 +237,7 @@ Levels: act nsw nt qld sa tas vic wa
[4,] 4 8 12 16 20
>
> n <- 60
-> b <- 5 ; blocks <- rep(1:b, length= n)
+> b <- 5 ; blocks <- rep(1:b, length.out= n)
> v <- 6 ; varieties <- gl(v,10)
>
> Xb <- matrix(0, n, b)
@@ -263,7 +263,7 @@ blocks 1 2 3 4 5 6
> h <- 1:17
> Z <- array(h, dim=c(3,4,2))
> ## If the size of 'h' is exactly 24
-> h <- rep(h, length = 24)
+> h <- rep(h, length.out = 24)
> Z. <- Z ## the result is the same as
> Z <- h; dim(Z) <- c(3,4,2)
> stopifnot(identical(Z., Z))
@@ -518,7 +518,7 @@ incomef act nsw nt qld sa tas vic wa
>
> ##
postscript("images/hist.eps", ...)
> # make the bins smaller, make a plot of density
-> hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE)
+> hist(eruptions, seq(1.6, 5.2, 0.2), probability=TRUE)
> lines(density(eruptions, bw=0.1))
> rug(eruptions) # show the actual data points
> ## dev.off()
@@ -648,7 +648,7 @@ In wilcox.test.default(A, B) : cannot compute exact p-value with ties
> ###--- @appendix A sample session
>
> ## "Simulate starting a new R session, by
-> rm(list=ls(all=TRUE))
+> rm(list=ls(all.names=TRUE))
> set.seed(123) # for repeatability
>
> if(interactive())
@@ -706,7 +706,7 @@ Residual standard error: 1.92 on 18 degrees of freedom
Multiple R-squared: 0.904, Adjusted R-squared: 0.898
F-statistic: 169 on 1 and 18 DF, p-value: 1.39e-10
-> fm1 <- lm(y ~ x, data=dummy, weight=1/w^2)
+> fm1 <- lm(y ~ x, data=dummy, weights=1/w^2)
> summary(fm1)
Call:
@@ -877,7 +877,7 @@ Model 2: Speed ~ Run + Expt
> detach()
> rm(fm, fm0)
>
-> x <- seq(-pi, pi, len=50)
+> x <- seq(-pi, pi, length.out=50)
> y <- x
> f <- outer(x, y, function(x, y) cos(y)/(1 + x^2))
> oldpar <- par(no.readonly = TRUE)
@@ -892,7 +892,7 @@ Model 2: Speed ~ Run + Expt
> objects(); rm(x, y, f, fa)
[1] "f" "fa" "filepath" "mm" "oldpar"
[6] "w" "x" "y"
-> th <- seq(-pi, pi, len=100)
+> th <- seq(-pi, pi, length.out=100)
> z <- exp(1i*th)
> par(pty="s")
> plot(z, type="l")
diff --git a/tests/arith-true.R b/tests/arith-true.R
index 9cc8abfeb67..1b155bf59bc 100644
--- a/tests/arith-true.R
+++ b/tests/arith-true.R
@@ -130,7 +130,7 @@ all.equal(digamma(n + 1/2),
## higher psigamma:
all.equal(psigamma(1, deriv=c(1,3,5)),
pi^(2*(1:3)) * c(1/6, 1/15, 8/63), tolerance = 32*Meps)
-x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length=61), 5.1, 77)
+x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length.out=61), 5.1, 77)
## Intel icc showed a < 1ulp difference in the second.
stopifnot(all.equal( digamma(x), psigamma(x,0), tolerance = 2*Meps),
all.equal(trigamma(x), psigamma(x,1), tolerance = 2*Meps))# TRUE (+ NaN warnings)
@@ -161,7 +161,7 @@ ok
## var():
for(n in 2:10)
print(all.equal(n*(n-1)*var(diag(n)),
- matrix(c(rep(c(n-1,rep(-1,n)),n-1), n-1), nr=n, nc=n),
+ matrix(c(rep(c(n-1,rep(-1,n)),n-1), n-1), nrow=n, ncol=n),
tolerance = 20*Meps)) # use tolerance = 0 to see rel.error
## pmin() & pmax() -- "attributes" !
@@ -180,20 +180,20 @@ oo <- options(warn = -1)# These four lines each would give 3-4 warnings :
options(oo)
## pretty()
-stopifnot(pretty(1:15) == seq(0,16, by=2),
- pretty(1:15, h=2) == seq(0,15, by=5),
- pretty(1) == 0:1,
- pretty(pi) == c(2,4),
- pretty(pi, n=6) == 2:4,
- pretty(pi, n=10) == 2:5,
- pretty(pi, shr=.1)== c(3, 3.5))
+stopifnot(pretty(1:15) == seq(0,16, by=2),
+ pretty(1:15, high.u.bias=2) == seq(0,15, by=5),
+ pretty(1) == 0:1,
+ pretty(pi) == c(2,4),
+ pretty(pi, n=6) == 2:4,
+ pretty(pi, n=10) == 2:5,
+ pretty(pi, shrink.sml=.1) == c(3, 3.5))
## gave infinite loop [R 0.64; Solaris], seealso PR#390 :
-all(pretty((1-1e-5)*c(1,1+3*Meps), 7) == seq(0,1,len=3))
+all(pretty((1-1e-5)*c(1,1+3*Meps), 7) == seq(0,1,length.out=3))
n <- 1000
x12 <- matrix(NA, 2,n); x12[,1] <- c(2.8,3) # Bug PR#673
-for(j in 1:2) x12[j, -1] <- round(rnorm(n-1), dig = rpois(n-1, lam=3.5) - 2)
+for(j in 1:2) x12[j, -1] <- round(rnorm(n-1), digits = rpois(n-1, lambda=3.5) - 2)
for(i in 1:n) {
lp <- length(p <- pretty(x <- sort(x12[,i])))
stopifnot(p[1] <= x[1] & x[2] <= p[lp],
diff --git a/tests/arith-true.Rout.save b/tests/arith-true.Rout.save
index be446c9ed19..90a814da1db 100644
--- a/tests/arith-true.Rout.save
+++ b/tests/arith-true.Rout.save
@@ -208,7 +208,7 @@ In gamma(0:-47) : NaNs produced
> all.equal(psigamma(1, deriv=c(1,3,5)),
+ pi^(2*(1:3)) * c(1/6, 1/15, 8/63), tolerance = 32*Meps)
[1] TRUE
-> x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length=61), 5.1, 77)
+> x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length.out=61), 5.1, 77)
> ## Intel icc showed a < 1ulp difference in the second.
> stopifnot(all.equal( digamma(x), psigamma(x,0), tolerance = 2*Meps),
+ all.equal(trigamma(x), psigamma(x,1), tolerance = 2*Meps))# TRUE (+ NaN warnings)
@@ -244,7 +244,7 @@ Warning messages:
> ## var():
> for(n in 2:10)
+ print(all.equal(n*(n-1)*var(diag(n)),
-+ matrix(c(rep(c(n-1,rep(-1,n)),n-1), n-1), nr=n, nc=n),
++ matrix(c(rep(c(n-1,rep(-1,n)),n-1), n-1), nrow=n, ncol=n),
+ tolerance = 20*Meps)) # use tolerance = 0 to see rel.error
[1] TRUE
[1] TRUE
@@ -278,21 +278,21 @@ Warning messages:
> options(oo)
>
> ## pretty()
-> stopifnot(pretty(1:15) == seq(0,16, by=2),
-+ pretty(1:15, h=2) == seq(0,15, by=5),
-+ pretty(1) == 0:1,
-+ pretty(pi) == c(2,4),
-+ pretty(pi, n=6) == 2:4,
-+ pretty(pi, n=10) == 2:5,
-+ pretty(pi, shr=.1)== c(3, 3.5))
+> stopifnot(pretty(1:15) == seq(0,16, by=2),
++ pretty(1:15, high.u.bias=2) == seq(0,15, by=5),
++ pretty(1) == 0:1,
++ pretty(pi) == c(2,4),
++ pretty(pi, n=6) == 2:4,
++ pretty(pi, n=10) == 2:5,
++ pretty(pi, shrink.sml=.1) == c(3, 3.5))
>
> ## gave infinite loop [R 0.64; Solaris], seealso PR#390 :
-> all(pretty((1-1e-5)*c(1,1+3*Meps), 7) == seq(0,1,len=3))
+> all(pretty((1-1e-5)*c(1,1+3*Meps), 7) == seq(0,1,length.out=3))
[1] TRUE
>
> n <- 1000
> x12 <- matrix(NA, 2,n); x12[,1] <- c(2.8,3) # Bug PR#673
-> for(j in 1:2) x12[j, -1] <- round(rnorm(n-1), dig = rpois(n-1, lam=3.5) - 2)
+> for(j in 1:2) x12[j, -1] <- round(rnorm(n-1), digits = rpois(n-1, lambda=3.5) - 2)
> for(i in 1:n) {
+ lp <- length(p <- pretty(x <- sort(x12[,i])))
+ stopifnot(p[1] <= x[1] & x[2] <= p[lp],
diff --git a/tests/complex.R b/tests/complex.R
index 42a5dc0a204..d52548f8c03 100644
--- a/tests/complex.R
+++ b/tests/complex.R
@@ -74,7 +74,7 @@ all(abs(Isi-1) < 100* Meps)
##P table(2*abs(Isi-1) / Meps)
set.seed(123)
-z <- complex(real = rnorm(100), imag = rnorm(100))
+z <- complex(real = rnorm(100), imaginary = rnorm(100))
stopifnot(Mod ( 1 - sin(z) / ( (exp(1i*z)-exp(-1i*z))/(2*1i) )) < 20 * Meps)
## end of moved from complex.Rd
@@ -103,7 +103,7 @@ stopifnot(all.equal(z, pi/2+0i))
## Hyperbolic
-x <- seq(-3, 3, len=200)
+x <- seq(-3, 3, length.out=200)
Meps <- .Machine$double.eps
stopifnot(
Mod(cosh(x) - cos(1i*x)) < 20*Meps,
@@ -132,11 +132,11 @@ stopifnot(identical(tanh(356+0i), 1+0i))
## Not a regression test, but rather one of the good cases:
(cNaN <- as.complex("NaN"))
-stopifnot(identical(cNaN, complex(re = NaN)), is.nan(Re(cNaN)), Im(cNaN) == 0)
+stopifnot(identical(cNaN, complex(real = NaN)), is.nan(Re(cNaN)), Im(cNaN) == 0)
dput(cNaN) ## (real = NaN, imaginary = 0)
## Partly new behavior:
-(c0NaN <- complex(real=0, im=NaN))
-(cNaNaN <- complex(re=NaN, im=NaN))
+(c0NaN <- complex(real=0, imaginary=NaN))
+(cNaNaN <- complex(real=NaN, imaginary=NaN))
stopifnot(identical(cNaN, as.complex(NaN)),
identical(vapply(c(cNaN, c0NaN, cNaNaN), format, ""),
c("NaN+0i", "0+NaNi", "NaN+NaNi")),
@@ -146,8 +146,8 @@ stopifnot(identical(cNaN, as.complex(NaN)),
identical(cNaNaN, 1i * NaN),
identical(cNaNaN, complex(modulus= NaN)),
- identical(cNaNaN, complex(argument= NaN)),
- identical(cNaNaN, complex(arg=NaN, mod=NaN)),
+ identical(cNaNaN, complex(argument=NaN)),
+ identical(cNaNaN, complex(argument=NaN, modulus=NaN)),
identical(c0NaN, c0NaN+c0NaN), # !
## Platform dependent, not TRUE e.g. on F21 gcc 4.9.2:
diff --git a/tests/complex.Rout.save b/tests/complex.Rout.save
index 979ffbfa0d8..104c14bfc34 100644
--- a/tests/complex.Rout.save
+++ b/tests/complex.Rout.save
@@ -194,7 +194,7 @@ n= 30 : 465+0i -15+142.7155i -15+70.56945i -15+46.16525i -15+33.69055i -15+25.98
> ##P table(2*abs(Isi-1) / Meps)
>
> set.seed(123)
-> z <- complex(real = rnorm(100), imag = rnorm(100))
+> z <- complex(real = rnorm(100), imaginary = rnorm(100))
> stopifnot(Mod ( 1 - sin(z) / ( (exp(1i*z)-exp(-1i*z))/(2*1i) )) < 20 * Meps)
> ## end of moved from complex.Rd
>
@@ -230,7 +230,7 @@ n= 30 : 465+0i -15+142.7155i -15+70.56945i -15+46.16525i -15+33.69055i -15+25.98
>
>
> ## Hyperbolic
-> x <- seq(-3, 3, len=200)
+> x <- seq(-3, 3, length.out=200)
> Meps <- .Machine$double.eps
> stopifnot(
+ Mod(cosh(x) - cos(1i*x)) < 20*Meps,
@@ -266,13 +266,13 @@ n= 30 : 465+0i -15+142.7155i -15+70.56945i -15+46.16525i -15+33.69055i -15+25.98
> ## Not a regression test, but rather one of the good cases:
> (cNaN <- as.complex("NaN"))
[1] NaN+0i
-> stopifnot(identical(cNaN, complex(re = NaN)), is.nan(Re(cNaN)), Im(cNaN) == 0)
+> stopifnot(identical(cNaN, complex(real = NaN)), is.nan(Re(cNaN)), Im(cNaN) == 0)
> dput(cNaN) ## (real = NaN, imaginary = 0)
complex(real=NaN, imaginary=0)
> ## Partly new behavior:
-> (c0NaN <- complex(real=0, im=NaN))
+> (c0NaN <- complex(real=0, imaginary=NaN))
[1] 0+NaNi
-> (cNaNaN <- complex(re=NaN, im=NaN))
+> (cNaNaN <- complex(real=NaN, imaginary=NaN))
[1] NaN+NaNi
> stopifnot(identical(cNaN, as.complex(NaN)),
+ identical(vapply(c(cNaN, c0NaN, cNaNaN), format, ""),
@@ -283,8 +283,8 @@ complex(real=NaN, imaginary=0)
+
+ identical(cNaNaN, 1i * NaN),
+ identical(cNaNaN, complex(modulus= NaN)),
-+ identical(cNaNaN, complex(argument= NaN)),
-+ identical(cNaNaN, complex(arg=NaN, mod=NaN)),
++ identical(cNaNaN, complex(argument=NaN)),
++ identical(cNaNaN, complex(argument=NaN, modulus=NaN)),
+
+ identical(c0NaN, c0NaN+c0NaN), # !
+ ## Platform dependent, not TRUE e.g. on F21 gcc 4.9.2:
diff --git a/tests/d-p-q-r-tests.R b/tests/d-p-q-r-tests.R
index 64b6d7d1a85..208688a6b32 100644
--- a/tests/d-p-q-r-tests.R
+++ b/tests/d-p-q-r-tests.R
@@ -55,7 +55,7 @@ PQonly <- c("tukey")
## Cumulative Binomial '==' Cumulative F :
## Abramowitz & Stegun, p.945-6; 26.5.24 AND 26.5.28 :
n0 <- 50; n1 <- 16; n2 <- 20; n3 <- 8
-for(n in rbinom(n1, size = 2*n0, p = .4)) {
+for(n in rbinom(n1, size = 2*n0, prob = .4)) {
for(p in c(0,1,rbeta(n2, 2,4))) {
for(k in rbinom(n3, size = n, prob = runif(1)))
## For X ~ Bin(n,p), compute 1 - P[X > k] = P[X <= k] in three ways:
@@ -68,7 +68,7 @@ for(n in rbinom(n1, size = 2*n0, p = .4)) {
}
##__ 2. Geometric __
-for(pr in seq(1e-10,1,len=15)) # p=0 is not a distribution
+for(pr in seq(1e-10,1,length.out=15)) # p=0 is not a distribution
stopifnot(All.eq((dg <- dgeom(0:10, pr)),
pr * (1-pr)^(0:10)),
All.eq(cumsum(dg), pgeom(0:10, pr)))
@@ -117,15 +117,15 @@ for(lambda in rexp(n1))
##__ 6. SignRank __
-for(n in rpois(32, lam=8)) {
+for(n in rpois(32, lambda=8)) {
x <- -1:(n + 4)
stopifnot(All.eq(psignrank(x, n), cumsum(dsignrank(x, n))))
}
##__ 7. Wilcoxon (symmetry & cumulative) __
is.sym <- TRUE
-for(n in rpois(5, lam=6))
- for(m in rpois(15, lam=8)) {
+for(n in rpois(5, lambda=6))
+ for(m in rpois(15, lambda=8)) {
x <- -1:(n*m + 1)
fx <- dwilcox(x, n, m)
Fx <- pwilcox(x, n, m)
@@ -158,7 +158,7 @@ assertWarning(stopifnot(
scLrg <- c(2,100, 1e300*c(.1, 1,10,100), 1e307, xMax, Inf)
stopifnot(pgamma(Inf, 1, scale=xMax) == 1,
pgamma(xMax,1, scale=Inf) == 0,
- all.equal(pgamma(1e300, 2, scale= scLrg, log=TRUE),
+ all.equal(pgamma(1e300, 2, scale= scLrg, log.p=TRUE),
c(0, 0, -0.000499523968713701, -1.33089326820406,
-5.36470502873211, -9.91015144019122,
-32.9293385491433, -38.707517174609, -Inf),
@@ -168,9 +168,9 @@ stopifnot(pgamma(Inf, 1, scale=xMax) == 1,
p <- 7e-4; df <- 0.9
stopifnot(
abs(1-c(pchisq(qchisq(p, df),df)/p, # was 2.31e-8 for R <= 1.8.1
- pchisq(qchisq(1-p, df,lower=FALSE),df,lower=FALSE)/(1-p),# was 1.618e-11
- pchisq(qchisq(log(p), df,log=TRUE),df, log=TRUE)/log(p), # was 3.181e-9
- pchisq(qchisq(log1p(-p),df,log=T,lower=F),df, log=T,lower=F)/log1p(-p)
+ pchisq(qchisq(1-p, df,lower.tail=FALSE),df,lower.tail=FALSE)/(1-p),# was 1.618e-11
+ pchisq(qchisq(log(p), df,log.p=TRUE),df, log.p=TRUE)/log(p), # was 3.181e-9
+ pchisq(qchisq(log1p(-p),df,log.p=TRUE,lower.tail=FALSE),df, log.p=TRUE,lower.tail=FALSE)/log1p(-p)
)# 32b-i386: (2.2e-16, 0,0, 3.3e-16); Opteron: (2.2e-16, 0,0, 2.2e-15)
) < 1e-14
)
@@ -218,8 +218,8 @@ stopifnot(which(isI <- sp == -Inf) ==
##--- Normal (& Lognormal) :
stopifnot(
- qnorm(0) == -Inf, qnorm(-Inf, log = TRUE) == -Inf,
- qnorm(1) == Inf, qnorm( 0, log = TRUE) == Inf)
+ qnorm(0) == -Inf, qnorm(-Inf, log.p = TRUE) == -Inf,
+ qnorm(1) == Inf, qnorm( 0, log.p = TRUE) == Inf)
assertWarning(stopifnot(
is.nan(qnorm(1.1)),
@@ -227,10 +227,10 @@ assertWarning(stopifnot(
x <- c(-Inf, -1e100, 1:6, 1e200, Inf)
stopifnot(
- dnorm(x,3,s=0) == c(0,0,0,0, Inf, 0,0,0,0,0),
- pnorm(x,3,s=0) == c(0,0,0,0, 1 , 1,1,1,1,1),
- dnorm(x,3,s=Inf) == 0,
- pnorm(x,3,s=Inf) == c(0, rep(0.5, 8), 1))
+ dnorm(x,3,sd=0) == c(0,0,0,0, Inf, 0,0,0,0,0),
+ pnorm(x,3,sd=0) == c(0,0,0,0, 1 , 1,1,1,1,1),
+ dnorm(x,3,sd=Inf) == 0,
+ pnorm(x,3,sd=Inf) == c(0, rep(0.5, 8), 1))
stopifnot(
## 3 Test data from Wichura (1988) :
@@ -238,9 +238,9 @@ stopifnot(
c(-0.6744897501960817, -3.090232306167814, -9.262340089798408),
tolerance = 1e-15)
, ## extreme tail -- available on log scale only:
- all.equal(qe5 <- qnorm(-1e5, log = TRUE), -447.1978937)
+ all.equal(qe5 <- qnorm(-1e5, log.p = TRUE), -447.1978937)
, ## much more accurate (2022-08):
- All.eq(-1e5, pnorm(qe5, log = TRUE))
+ All.eq(-1e5, pnorm(qe5, log.p = TRUE))
)
z <- rnorm(1000); all.equal(pnorm(z), 1 - pnorm(-z), tolerance = 1e-15)
@@ -248,20 +248,20 @@ z <- c(-Inf,Inf,NA,NaN, rt(1000, df=2))
z.ok <- z > -37.5 | !is.finite(z)
for(df in 1:10) stopifnot(all.equal(pt(z, df), 1 - pt(-z,df), tolerance = 1e-15))
-stopifnot(All.eq(pz <- pnorm(z), 1 - pnorm(z, lower=FALSE)),
- All.eq(pz, pnorm(-z, lower=FALSE)),
- All.eq(log(pz[z.ok]), pnorm(z[z.ok], log=TRUE)))
+stopifnot(All.eq(pz <- pnorm(z), 1 - pnorm(z, lower.tail=FALSE)),
+ All.eq(pz, pnorm(-z, lower.tail=FALSE)),
+ All.eq(log(pz[z.ok]), pnorm(z[z.ok], log.p=TRUE)))
y <- seq(-70,0, by = 10)
-cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log=TRUE))
+cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log.p=TRUE))
y <- c(1:15, seq(20,40, by=5))
-cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log=TRUE),
- "log(pnorm(-y))"= log(pnorm(-y)), "pnorm(-y, log=T)"= pnorm(-y, log=TRUE))
+cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log.p=TRUE),
+ "log(pnorm(-y))"= log(pnorm(-y)), "pnorm(-y, log=T)"= pnorm(-y, log.p=TRUE))
## Symmetry:
y <- c(1:50,10^c(3:10,20,50,150,250))
y <- c(-y,0,y)
for(L in c(FALSE,TRUE))
- stopifnot(identical(pnorm(-y, log= L),
- pnorm(+y, log= L, lower=FALSE)))
+ stopifnot(identical(pnorm(-y, log.p= L),
+ pnorm(+y, log.p= L, lower.tail=FALSE)))
## Log norm
stopifnot(All.eq(pz, plnorm(exp(z))))
@@ -369,93 +369,93 @@ All.eq(Rwilcox, qwilcox (Pwilcox*f1, m = 13, n = 17))
## Same with "upper tail":
p1 <- 1 + ep
-All.eq(Rbeta, qbeta (1- Pbeta, shape1 = .8, shape2 = 2, lower=F))
-All.eq(Rbinom, qbinom (p1- Pbinom, size = 55, prob = pi/16, lower=F))
-All.eq(Rcauchy, qcauchy (1- Pcauchy, location = 12, scale = 2, lower=F))
-All.eq(Rchisq, qchisq (1- Pchisq, df = 3, lower=F))
-All.eq(Rexp, qexp (1- Pexp, rate = 2, lower=F))
-All.eq(Rf, qf (1- Pf, df1 = 12, df2 = 6, lower=F))
-All.eq(Rgamma, qgamma (1- Pgamma, shape = 2, scale = 5, lower=F))
-All.eq(Rgeom, qgeom (p1- Pgeom, prob = pi/16, lower=F))
-All.eq(Rhyper, qhyper (p1- Phyper, m = 40, n = 30, k = 20, lower=F))
-All.eq(Rlnorm, qlnorm (1- Plnorm, meanlog = -1, sdlog = 3, lower=F))
-All.eq(Rlogis, qlogis (1- Plogis, location = 12, scale = 2, lower=F))
-All.eq(Rnbinom, qnbinom (p1- Pnbinom, size = 7, prob = .01, lower=F))
-All.eq(Rnorm, qnorm (1- Pnorm, mean = -1, sd = 3,lower=F))
-All.eq(Rpois, qpois (p1- Ppois, lambda = 12, lower=F))
-All.eq(Rsignrank, qsignrank(p1-Psignrank, n = 47, lower=F))
-All.eq(Rt, qt (1- Pt, df = 11, lower=F))
-All.eq(Rt2, qt (1- Pt2, df = 1.01, lower=F))
-All.eq(Runif, qunif (1- Punif, min = .2, max = 2, lower=F))
-All.eq(Rweibull, qweibull (1- Pweibull, shape = 3, scale = 2, lower=F))
-All.eq(Rwilcox, qwilcox (p1- Pwilcox, m = 13, n = 17, lower=F))
+All.eq(Rbeta, qbeta (1- Pbeta, shape1 = .8, shape2 = 2, lower.tail=FALSE))
+All.eq(Rbinom, qbinom (p1- Pbinom, size = 55, prob = pi/16, lower.tail=FALSE))
+All.eq(Rcauchy, qcauchy (1- Pcauchy, location = 12, scale = 2, lower.tail=FALSE))
+All.eq(Rchisq, qchisq (1- Pchisq, df = 3, lower.tail=FALSE))
+All.eq(Rexp, qexp (1- Pexp, rate = 2, lower.tail=FALSE))
+All.eq(Rf, qf (1- Pf, df1 = 12, df2 = 6, lower.tail=FALSE))
+All.eq(Rgamma, qgamma (1- Pgamma, shape = 2, scale = 5, lower.tail=FALSE))
+All.eq(Rgeom, qgeom (p1- Pgeom, prob = pi/16, lower.tail=FALSE))
+All.eq(Rhyper, qhyper (p1- Phyper, m = 40, n = 30, k = 20, lower.tail=FALSE))
+All.eq(Rlnorm, qlnorm (1- Plnorm, meanlog = -1, sdlog = 3, lower.tail=FALSE))
+All.eq(Rlogis, qlogis (1- Plogis, location = 12, scale = 2, lower.tail=FALSE))
+All.eq(Rnbinom, qnbinom (p1- Pnbinom, size = 7, prob = .01, lower.tail=FALSE))
+All.eq(Rnorm, qnorm (1- Pnorm, mean = -1, sd = 3,lower.tail=FALSE))
+All.eq(Rpois, qpois (p1- Ppois, lambda = 12, lower.tail=FALSE))
+All.eq(Rsignrank, qsignrank(p1-Psignrank, n = 47, lower.tail=FALSE))
+All.eq(Rt, qt (1- Pt, df = 11, lower.tail=FALSE))
+All.eq(Rt2, qt (1- Pt2, df = 1.01, lower.tail=FALSE))
+All.eq(Runif, qunif (1- Punif, min = .2, max = 2, lower.tail=FALSE))
+All.eq(Rweibull, qweibull (1- Pweibull, shape = 3, scale = 2, lower.tail=FALSE))
+All.eq(Rwilcox, qwilcox (p1- Pwilcox, m = 13, n = 17, lower.tail=FALSE))
## Check q*(p* ( log ), log) = identity
-All.eq(Rbeta, qbeta (log(Pbeta), shape1 = .8, shape2 = 2, log=TRUE))
-All.eq(Rbinom, qbinom (log(Pbinom)-ep, size = 55, prob = pi/16, log=TRUE))
-All.eq(Rcauchy, qcauchy (log(Pcauchy), location = 12, scale = 2, log=TRUE))
-All.eq(Rchisq, qchisq (log(Pchisq), df = 3, log=TRUE))
-All.eq(Rexp, qexp (log(Pexp), rate = 2, log=TRUE))
-All.eq(Rf, qf (log(Pf), df1= 12, df2= 6, log=TRUE))
-All.eq(Rgamma, qgamma (log(Pgamma), shape = 2, scale = 5, log=TRUE))
-All.eq(Rgeom, qgeom (log(Pgeom)-ep, prob = pi/16, log=TRUE))
-All.eq(Rhyper, qhyper (log(Phyper)-ep, m = 40, n = 30, k = 20, log=TRUE))
-All.eq(Rlnorm, qlnorm (log(Plnorm), meanlog = -1, sdlog = 3, log=TRUE))
-All.eq(Rlogis, qlogis (log(Plogis), location = 12, scale = 2, log=TRUE))
-All.eq(Rnbinom, qnbinom (log(Pnbinom)-ep, size = 7, prob = .01, log=TRUE))
-All.eq(Rnorm, qnorm (log(Pnorm), mean = -1, sd = 3, log=TRUE))
-All.eq(Rpois, qpois (log(Ppois)-ep, lambda = 12, log=TRUE)) # fuzz for Solaris
-All.eq(Rsignrank, qsignrank(log(Psignrank)-ep, n = 47, log=TRUE))
-All.eq(Rt, qt (log(Pt), df = 11, log=TRUE))
-All.eq(Rt2, qt (log(Pt2), df = 1.01, log=TRUE))
-All.eq(Runif, qunif (log(Punif), min = .2, max = 2, log=TRUE))
-All.eq(Rweibull, qweibull (log(Pweibull), shape = 3, scale = 2, log=TRUE))
-All.eq(Rwilcox, qwilcox (log(Pwilcox)-ep, m = 13, n = 17, log=TRUE))
+All.eq(Rbeta, qbeta (log(Pbeta), shape1 = .8, shape2 = 2, log.p=TRUE))
+All.eq(Rbinom, qbinom (log(Pbinom)-ep, size = 55, prob = pi/16, log.p=TRUE))
+All.eq(Rcauchy, qcauchy (log(Pcauchy), location = 12, scale = 2, log.p=TRUE))
+All.eq(Rchisq, qchisq (log(Pchisq), df = 3, log.p=TRUE))
+All.eq(Rexp, qexp (log(Pexp), rate = 2, log.p=TRUE))
+All.eq(Rf, qf (log(Pf), df1= 12, df2= 6, log.p=TRUE))
+All.eq(Rgamma, qgamma (log(Pgamma), shape = 2, scale = 5, log.p=TRUE))
+All.eq(Rgeom, qgeom (log(Pgeom)-ep, prob = pi/16, log.p=TRUE))
+All.eq(Rhyper, qhyper (log(Phyper)-ep, m = 40, n = 30, k = 20, log.p=TRUE))
+All.eq(Rlnorm, qlnorm (log(Plnorm), meanlog = -1, sdlog = 3, log.p=TRUE))
+All.eq(Rlogis, qlogis (log(Plogis), location = 12, scale = 2, log.p=TRUE))
+All.eq(Rnbinom, qnbinom (log(Pnbinom)-ep, size = 7, prob = .01, log.p=TRUE))
+All.eq(Rnorm, qnorm (log(Pnorm), mean = -1, sd = 3, log.p=TRUE))
+All.eq(Rpois, qpois (log(Ppois)-ep, lambda = 12, log.p=TRUE)) # fuzz for Solaris
+All.eq(Rsignrank, qsignrank(log(Psignrank)-ep, n = 47, log.p=TRUE))
+All.eq(Rt, qt (log(Pt), df = 11, log.p=TRUE))
+All.eq(Rt2, qt (log(Pt2), df = 1.01, log.p=TRUE))
+All.eq(Runif, qunif (log(Punif), min = .2, max = 2, log.p=TRUE))
+All.eq(Rweibull, qweibull (log(Pweibull), shape = 3, scale = 2, log.p=TRUE))
+All.eq(Rwilcox, qwilcox (log(Pwilcox)-ep, m = 13, n = 17, log.p=TRUE))
## same q*(p* (log) log) with upper tail:
-All.eq(Rbeta, qbeta (log1p(-Pbeta), shape1 = .8, shape2 = 2, lower=F, log=T))
-All.eq(Rbinom, qbinom (log1p(-Pbinom)+ep, size = 55, prob = pi/16, lower=F, log=T))
-All.eq(Rcauchy, qcauchy (log1p(-Pcauchy), location = 12, scale = 2, lower=F, log=T))
-All.eq(Rchisq, qchisq (log1p(-Pchisq), df = 3, lower=F, log=T))
-All.eq(Rexp, qexp (log1p(-Pexp), rate = 2, lower=F, log=T))
-All.eq(Rf, qf (log1p(-Pf), df1 = 12, df2 = 6, lower=F, log=T))
-All.eq(Rgamma, qgamma (log1p(-Pgamma), shape = 2, scale = 5, lower=F, log=T))
-All.eq(Rgeom, qgeom (log1p(-Pgeom)+ep, prob = pi/16, lower=F, log=T))
-All.eq(Rhyper, qhyper (log1p(-Phyper)+ep, m = 40, n = 30, k = 20, lower=F, log=T))
-All.eq(Rlnorm, qlnorm (log1p(-Plnorm), meanlog = -1, sdlog = 3, lower=F, log=T))
-All.eq(Rlogis, qlogis (log1p(-Plogis), location = 12, scale = 2, lower=F, log=T))
-All.eq(Rnbinom, qnbinom (log1p(-Pnbinom)+ep, size = 7, prob = .01, lower=F, log=T))
-All.eq(Rnorm, qnorm (log1p(-Pnorm), mean = -1, sd = 3, lower=F, log=T))
-All.eq(Rpois, qpois (log1p(-Ppois)+ep, lambda = 12, lower=F, log=T))
-All.eq(Rsignrank, qsignrank(log1p(-Psignrank)+ep, n = 47, lower=F, log=T))
-All.eq(Rt, qt (log1p(-Pt ), df = 11, lower=F, log=T))
-All.eq(Rt2, qt (log1p(-Pt2), df = 1.01, lower=F, log=T))
-All.eq(Runif, qunif (log1p(-Punif), min = .2, max = 2, lower=F, log=T))
-All.eq(Rweibull, qweibull (log1p(-Pweibull), shape = 3, scale = 2, lower=F, log=T))
-All.eq(Rwilcox, qwilcox (log1p(-Pwilcox)+ep, m = 13, n = 17, lower=F, log=T))
+All.eq(Rbeta, qbeta (log1p(-Pbeta), shape1 = .8, shape2 = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rbinom, qbinom (log1p(-Pbinom)+ep, size = 55, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rcauchy, qcauchy (log1p(-Pcauchy), location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rchisq, qchisq (log1p(-Pchisq), df = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rexp, qexp (log1p(-Pexp), rate = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rf, qf (log1p(-Pf), df1 = 12, df2 = 6, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rgamma, qgamma (log1p(-Pgamma), shape = 2, scale = 5, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rgeom, qgeom (log1p(-Pgeom)+ep, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rhyper, qhyper (log1p(-Phyper)+ep, m = 40, n = 30, k = 20, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rlnorm, qlnorm (log1p(-Plnorm), meanlog = -1, sdlog = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rlogis, qlogis (log1p(-Plogis), location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rnbinom, qnbinom (log1p(-Pnbinom)+ep, size = 7, prob = .01, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rnorm, qnorm (log1p(-Pnorm), mean = -1, sd = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rpois, qpois (log1p(-Ppois)+ep, lambda = 12, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rsignrank, qsignrank(log1p(-Psignrank)+ep, n = 47, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rt, qt (log1p(-Pt ), df = 11, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rt2, qt (log1p(-Pt2), df = 1.01, lower.tail=FALSE, log.p=TRUE))
+All.eq(Runif, qunif (log1p(-Punif), min = .2, max = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rweibull, qweibull (log1p(-Pweibull), shape = 3, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(Rwilcox, qwilcox (log1p(-Pwilcox)+ep, m = 13, n = 17, lower.tail=FALSE, log.p=TRUE))
## Check log( upper.tail ):
-All.eq(log1p(-Pbeta), pbeta (Rbeta, shape1 = .8, shape2 = 2, lower=F, log=T))
-All.eq(log1p(-Pbinom), pbinom (Rbinom, size = 55, prob = pi/16, lower=F, log=T))
-All.eq(log1p(-Pcauchy), pcauchy (Rcauchy, location = 12, scale = 2, lower=F, log=T))
-All.eq(log1p(-Pchisq), pchisq (Rchisq, df = 3, lower=F, log=T))
-All.eq(log1p(-Pexp), pexp (Rexp, rate = 2, lower=F, log=T))
-All.eq(log1p(-Pf), pf (Rf, df1 = 12, df2 = 6, lower=F, log=T))
-All.eq(log1p(-Pgamma), pgamma (Rgamma, shape = 2, scale = 5, lower=F, log=T))
-All.eq(log1p(-Pgeom), pgeom (Rgeom, prob = pi/16, lower=F, log=T))
-All.eq(log1p(-Phyper), phyper (Rhyper, m = 40, n = 30, k = 20, lower=F, log=T))
-All.eq(log1p(-Plnorm), plnorm (Rlnorm, meanlog = -1, sdlog = 3, lower=F, log=T))
-All.eq(log1p(-Plogis), plogis (Rlogis, location = 12, scale = 2, lower=F, log=T))
-All.eq(log1p(-Pnbinom), pnbinom (Rnbinom, size = 7, prob = .01, lower=F, log=T))
-All.eq(log1p(-Pnorm), pnorm (Rnorm, mean = -1, sd = 3, lower=F, log=T))
-All.eq(log1p(-Ppois), ppois (Rpois, lambda = 12, lower=F, log=T))
-All.eq(log1p(-Psignrank), psignrank(Rsignrank, n = 47, lower=F, log=T))
-All.eq(log1p(-Pt), pt (Rt, df = 11, lower=F, log=T))
-All.eq(log1p(-Pt2), pt (Rt2,df = 1.01, lower=F, log=T))
-All.eq(log1p(-Punif), punif (Runif, min = .2, max = 2, lower=F, log=T))
-All.eq(log1p(-Pweibull), pweibull (Rweibull, shape = 3, scale = 2, lower=F, log=T))
-All.eq(log1p(-Pwilcox), pwilcox (Rwilcox, m = 13, n = 17, lower=F, log=T))
+All.eq(log1p(-Pbeta), pbeta (Rbeta, shape1 = .8, shape2 = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pbinom), pbinom (Rbinom, size = 55, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pcauchy), pcauchy (Rcauchy, location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pchisq), pchisq (Rchisq, df = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pexp), pexp (Rexp, rate = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pf), pf (Rf, df1 = 12, df2 = 6, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pgamma), pgamma (Rgamma, shape = 2, scale = 5, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pgeom), pgeom (Rgeom, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Phyper), phyper (Rhyper, m = 40, n = 30, k = 20, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Plnorm), plnorm (Rlnorm, meanlog = -1, sdlog = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Plogis), plogis (Rlogis, location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pnbinom), pnbinom (Rnbinom, size = 7, prob = .01, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pnorm), pnorm (Rnorm, mean = -1, sd = 3, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Ppois), ppois (Rpois, lambda = 12, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Psignrank), psignrank(Rsignrank, n = 47, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pt), pt (Rt, df = 11, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pt2), pt (Rt2,df = 1.01, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Punif), punif (Runif, min = .2, max = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pweibull), pweibull (Rweibull, shape = 3, scale = 2, lower.tail=FALSE, log.p=TRUE))
+All.eq(log1p(-Pwilcox), pwilcox (Rwilcox, m = 13, n = 17, lower.tail=FALSE, log.p=TRUE))
## Inf df in pf etc.
diff --git a/tests/d-p-q-r-tests.Rout.save b/tests/d-p-q-r-tests.Rout.save
index 5f03914faf5..dcd8b5c67ff 100644
--- a/tests/d-p-q-r-tests.Rout.save
+++ b/tests/d-p-q-r-tests.Rout.save
@@ -72,7 +72,7 @@ Type 'q()' to quit R.
> ## Cumulative Binomial '==' Cumulative F :
> ## Abramowitz & Stegun, p.945-6; 26.5.24 AND 26.5.28 :
> n0 <- 50; n1 <- 16; n2 <- 20; n3 <- 8
-> for(n in rbinom(n1, size = 2*n0, p = .4)) {
+> for(n in rbinom(n1, size = 2*n0, prob = .4)) {
+ for(p in c(0,1,rbeta(n2, 2,4))) {
+ for(k in rbinom(n3, size = n, prob = runif(1)))
+ ## For X ~ Bin(n,p), compute 1 - P[X > k] = P[X <= k] in three ways:
@@ -85,7 +85,7 @@ Type 'q()' to quit R.
+ }
>
> ##__ 2. Geometric __
-> for(pr in seq(1e-10,1,len=15)) # p=0 is not a distribution
+> for(pr in seq(1e-10,1,length.out=15)) # p=0 is not a distribution
+ stopifnot(All.eq((dg <- dgeom(0:10, pr)),
+ pr * (1-pr)^(0:10)),
+ All.eq(cumsum(dg), pgeom(0:10, pr)))
@@ -143,15 +143,15 @@ Time 0.068 0.000 0.068
>
>
> ##__ 6. SignRank __
-> for(n in rpois(32, lam=8)) {
+> for(n in rpois(32, lambda=8)) {
+ x <- -1:(n + 4)
+ stopifnot(All.eq(psignrank(x, n), cumsum(dsignrank(x, n))))
+ }
>
> ##__ 7. Wilcoxon (symmetry & cumulative) __
> is.sym <- TRUE
-> for(n in rpois(5, lam=6))
-+ for(m in rpois(15, lam=8)) {
+> for(n in rpois(5, lambda=6))
++ for(m in rpois(15, lambda=8)) {
+ x <- -1:(n*m + 1)
+ fx <- dwilcox(x, n, m)
+ Fx <- pwilcox(x, n, m)
@@ -184,7 +184,7 @@ Time 0.068 0.000 0.068
> scLrg <- c(2,100, 1e300*c(.1, 1,10,100), 1e307, xMax, Inf)
> stopifnot(pgamma(Inf, 1, scale=xMax) == 1,
+ pgamma(xMax,1, scale=Inf) == 0,
-+ all.equal(pgamma(1e300, 2, scale= scLrg, log=TRUE),
++ all.equal(pgamma(1e300, 2, scale= scLrg, log.p=TRUE),
+ c(0, 0, -0.000499523968713701, -1.33089326820406,
+ -5.36470502873211, -9.91015144019122,
+ -32.9293385491433, -38.707517174609, -Inf),
@@ -194,9 +194,9 @@ Time 0.068 0.000 0.068
> p <- 7e-4; df <- 0.9
> stopifnot(
+ abs(1-c(pchisq(qchisq(p, df),df)/p, # was 2.31e-8 for R <= 1.8.1
-+ pchisq(qchisq(1-p, df,lower=FALSE),df,lower=FALSE)/(1-p),# was 1.618e-11
-+ pchisq(qchisq(log(p), df,log=TRUE),df, log=TRUE)/log(p), # was 3.181e-9
-+ pchisq(qchisq(log1p(-p),df,log=T,lower=F),df, log=T,lower=F)/log1p(-p)
++ pchisq(qchisq(1-p, df,lower.tail=FALSE),df,lower.tail=FALSE)/(1-p),# was 1.618e-11
++ pchisq(qchisq(log(p), df,log.p=TRUE),df, log.p=TRUE)/log(p), # was 3.181e-9
++ pchisq(qchisq(log1p(-p),df,log.p=TRUE,lower.tail=FALSE),df, log.p=TRUE,lower.tail=FALSE)/log1p(-p)
+ )# 32b-i386: (2.2e-16, 0,0, 3.3e-16); Opteron: (2.2e-16, 0,0, 2.2e-15)
+ ) < 1e-14
+ )
@@ -244,8 +244,8 @@ Time 0.068 0.000 0.068
> ##--- Normal (& Lognormal) :
>
> stopifnot(
-+ qnorm(0) == -Inf, qnorm(-Inf, log = TRUE) == -Inf,
-+ qnorm(1) == Inf, qnorm( 0, log = TRUE) == Inf)
++ qnorm(0) == -Inf, qnorm(-Inf, log.p = TRUE) == -Inf,
++ qnorm(1) == Inf, qnorm( 0, log.p = TRUE) == Inf)
>
> assertWarning(stopifnot(
+ is.nan(qnorm(1.1)),
@@ -253,10 +253,10 @@ Time 0.068 0.000 0.068
>
> x <- c(-Inf, -1e100, 1:6, 1e200, Inf)
> stopifnot(
-+ dnorm(x,3,s=0) == c(0,0,0,0, Inf, 0,0,0,0,0),
-+ pnorm(x,3,s=0) == c(0,0,0,0, 1 , 1,1,1,1,1),
-+ dnorm(x,3,s=Inf) == 0,
-+ pnorm(x,3,s=Inf) == c(0, rep(0.5, 8), 1))
++ dnorm(x,3,sd=0) == c(0,0,0,0, Inf, 0,0,0,0,0),
++ pnorm(x,3,sd=0) == c(0,0,0,0, 1 , 1,1,1,1,1),
++ dnorm(x,3,sd=Inf) == 0,
++ pnorm(x,3,sd=Inf) == c(0, rep(0.5, 8), 1))
>
> stopifnot(
+ ## 3 Test data from Wichura (1988) :
@@ -264,9 +264,9 @@ Time 0.068 0.000 0.068
+ c(-0.6744897501960817, -3.090232306167814, -9.262340089798408),
+ tolerance = 1e-15)
+ , ## extreme tail -- available on log scale only:
-+ all.equal(qe5 <- qnorm(-1e5, log = TRUE), -447.1978937)
++ all.equal(qe5 <- qnorm(-1e5, log.p = TRUE), -447.1978937)
+ , ## much more accurate (2022-08):
-+ All.eq(-1e5, pnorm(qe5, log = TRUE))
++ All.eq(-1e5, pnorm(qe5, log.p = TRUE))
+ )
>
> z <- rnorm(1000); all.equal(pnorm(z), 1 - pnorm(-z), tolerance = 1e-15)
@@ -275,11 +275,11 @@ Time 0.068 0.000 0.068
> z.ok <- z > -37.5 | !is.finite(z)
> for(df in 1:10) stopifnot(all.equal(pt(z, df), 1 - pt(-z,df), tolerance = 1e-15))
>
-> stopifnot(All.eq(pz <- pnorm(z), 1 - pnorm(z, lower=FALSE)),
-+ All.eq(pz, pnorm(-z, lower=FALSE)),
-+ All.eq(log(pz[z.ok]), pnorm(z[z.ok], log=TRUE)))
+> stopifnot(All.eq(pz <- pnorm(z), 1 - pnorm(z, lower.tail=FALSE)),
++ All.eq(pz, pnorm(-z, lower.tail=FALSE)),
++ All.eq(log(pz[z.ok]), pnorm(z[z.ok], log.p=TRUE)))
> y <- seq(-70,0, by = 10)
-> cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log=TRUE))
+> cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log.p=TRUE))
y log(pnorm(y)) pnorm(y, log=T)
[1,] -70 -Inf -2455.1676378
[2,] -60 -Inf -1805.0135607
@@ -290,8 +290,8 @@ Time 0.068 0.000 0.068
[7,] -10 -53.2312852 -53.2312852
[8,] 0 -0.6931472 -0.6931472
> y <- c(1:15, seq(20,40, by=5))
-> cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log=TRUE),
-+ "log(pnorm(-y))"= log(pnorm(-y)), "pnorm(-y, log=T)"= pnorm(-y, log=TRUE))
+> cbind(y, "log(pnorm(y))"= log(pnorm(y)), "pnorm(y, log=T)"= pnorm(y, log.p=TRUE),
++ "log(pnorm(-y))"= log(pnorm(-y)), "pnorm(-y, log=T)"= pnorm(-y, log.p=TRUE))
y log(pnorm(y)) pnorm(y, log=T) log(pnorm(-y)) pnorm(-y, log=T)
[1,] 1 -1.727538e-01 -1.727538e-01 -1.841022 -1.841022
[2,] 2 -2.301291e-02 -2.301291e-02 -3.783184 -3.783184
@@ -317,8 +317,8 @@ Time 0.068 0.000 0.068
> y <- c(1:50,10^c(3:10,20,50,150,250))
> y <- c(-y,0,y)
> for(L in c(FALSE,TRUE))
-+ stopifnot(identical(pnorm(-y, log= L),
-+ pnorm(+y, log= L, lower=FALSE)))
++ stopifnot(identical(pnorm(-y, log.p= L),
++ pnorm(+y, log.p= L, lower.tail=FALSE)))
>
> ## Log norm
> stopifnot(All.eq(pz, plnorm(exp(z))))
@@ -635,172 +635,172 @@ Time 0.068 0.000 0.068
>
> ## Same with "upper tail":
> p1 <- 1 + ep
-> All.eq(Rbeta, qbeta (1- Pbeta, shape1 = .8, shape2 = 2, lower=F))
+> All.eq(Rbeta, qbeta (1- Pbeta, shape1 = .8, shape2 = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rbinom, qbinom (p1- Pbinom, size = 55, prob = pi/16, lower=F))
+> All.eq(Rbinom, qbinom (p1- Pbinom, size = 55, prob = pi/16, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rcauchy, qcauchy (1- Pcauchy, location = 12, scale = 2, lower=F))
+> All.eq(Rcauchy, qcauchy (1- Pcauchy, location = 12, scale = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rchisq, qchisq (1- Pchisq, df = 3, lower=F))
+> All.eq(Rchisq, qchisq (1- Pchisq, df = 3, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rexp, qexp (1- Pexp, rate = 2, lower=F))
+> All.eq(Rexp, qexp (1- Pexp, rate = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rf, qf (1- Pf, df1 = 12, df2 = 6, lower=F))
+> All.eq(Rf, qf (1- Pf, df1 = 12, df2 = 6, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rgamma, qgamma (1- Pgamma, shape = 2, scale = 5, lower=F))
+> All.eq(Rgamma, qgamma (1- Pgamma, shape = 2, scale = 5, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rgeom, qgeom (p1- Pgeom, prob = pi/16, lower=F))
+> All.eq(Rgeom, qgeom (p1- Pgeom, prob = pi/16, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rhyper, qhyper (p1- Phyper, m = 40, n = 30, k = 20, lower=F))
+> All.eq(Rhyper, qhyper (p1- Phyper, m = 40, n = 30, k = 20, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rlnorm, qlnorm (1- Plnorm, meanlog = -1, sdlog = 3, lower=F))
+> All.eq(Rlnorm, qlnorm (1- Plnorm, meanlog = -1, sdlog = 3, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rlogis, qlogis (1- Plogis, location = 12, scale = 2, lower=F))
+> All.eq(Rlogis, qlogis (1- Plogis, location = 12, scale = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rnbinom, qnbinom (p1- Pnbinom, size = 7, prob = .01, lower=F))
+> All.eq(Rnbinom, qnbinom (p1- Pnbinom, size = 7, prob = .01, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rnorm, qnorm (1- Pnorm, mean = -1, sd = 3,lower=F))
+> All.eq(Rnorm, qnorm (1- Pnorm, mean = -1, sd = 3,lower.tail=FALSE))
[1] TRUE
-> All.eq(Rpois, qpois (p1- Ppois, lambda = 12, lower=F))
+> All.eq(Rpois, qpois (p1- Ppois, lambda = 12, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rsignrank, qsignrank(p1-Psignrank, n = 47, lower=F))
+> All.eq(Rsignrank, qsignrank(p1-Psignrank, n = 47, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rt, qt (1- Pt, df = 11, lower=F))
+> All.eq(Rt, qt (1- Pt, df = 11, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rt2, qt (1- Pt2, df = 1.01, lower=F))
+> All.eq(Rt2, qt (1- Pt2, df = 1.01, lower.tail=FALSE))
[1] TRUE
-> All.eq(Runif, qunif (1- Punif, min = .2, max = 2, lower=F))
+> All.eq(Runif, qunif (1- Punif, min = .2, max = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rweibull, qweibull (1- Pweibull, shape = 3, scale = 2, lower=F))
+> All.eq(Rweibull, qweibull (1- Pweibull, shape = 3, scale = 2, lower.tail=FALSE))
[1] TRUE
-> All.eq(Rwilcox, qwilcox (p1- Pwilcox, m = 13, n = 17, lower=F))
+> All.eq(Rwilcox, qwilcox (p1- Pwilcox, m = 13, n = 17, lower.tail=FALSE))
[1] TRUE
>
> ## Check q*(p* ( log ), log) = identity
-> All.eq(Rbeta, qbeta (log(Pbeta), shape1 = .8, shape2 = 2, log=TRUE))
+> All.eq(Rbeta, qbeta (log(Pbeta), shape1 = .8, shape2 = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rbinom, qbinom (log(Pbinom)-ep, size = 55, prob = pi/16, log=TRUE))
+> All.eq(Rbinom, qbinom (log(Pbinom)-ep, size = 55, prob = pi/16, log.p=TRUE))
[1] TRUE
-> All.eq(Rcauchy, qcauchy (log(Pcauchy), location = 12, scale = 2, log=TRUE))
+> All.eq(Rcauchy, qcauchy (log(Pcauchy), location = 12, scale = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rchisq, qchisq (log(Pchisq), df = 3, log=TRUE))
+> All.eq(Rchisq, qchisq (log(Pchisq), df = 3, log.p=TRUE))
[1] TRUE
-> All.eq(Rexp, qexp (log(Pexp), rate = 2, log=TRUE))
+> All.eq(Rexp, qexp (log(Pexp), rate = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rf, qf (log(Pf), df1= 12, df2= 6, log=TRUE))
+> All.eq(Rf, qf (log(Pf), df1= 12, df2= 6, log.p=TRUE))
[1] TRUE
-> All.eq(Rgamma, qgamma (log(Pgamma), shape = 2, scale = 5, log=TRUE))
+> All.eq(Rgamma, qgamma (log(Pgamma), shape = 2, scale = 5, log.p=TRUE))
[1] TRUE
-> All.eq(Rgeom, qgeom (log(Pgeom)-ep, prob = pi/16, log=TRUE))
+> All.eq(Rgeom, qgeom (log(Pgeom)-ep, prob = pi/16, log.p=TRUE))
[1] TRUE
-> All.eq(Rhyper, qhyper (log(Phyper)-ep, m = 40, n = 30, k = 20, log=TRUE))
+> All.eq(Rhyper, qhyper (log(Phyper)-ep, m = 40, n = 30, k = 20, log.p=TRUE))
[1] TRUE
-> All.eq(Rlnorm, qlnorm (log(Plnorm), meanlog = -1, sdlog = 3, log=TRUE))
+> All.eq(Rlnorm, qlnorm (log(Plnorm), meanlog = -1, sdlog = 3, log.p=TRUE))
[1] TRUE
-> All.eq(Rlogis, qlogis (log(Plogis), location = 12, scale = 2, log=TRUE))
+> All.eq(Rlogis, qlogis (log(Plogis), location = 12, scale = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rnbinom, qnbinom (log(Pnbinom)-ep, size = 7, prob = .01, log=TRUE))
+> All.eq(Rnbinom, qnbinom (log(Pnbinom)-ep, size = 7, prob = .01, log.p=TRUE))
[1] TRUE
-> All.eq(Rnorm, qnorm (log(Pnorm), mean = -1, sd = 3, log=TRUE))
+> All.eq(Rnorm, qnorm (log(Pnorm), mean = -1, sd = 3, log.p=TRUE))
[1] TRUE
-> All.eq(Rpois, qpois (log(Ppois)-ep, lambda = 12, log=TRUE)) # fuzz for Solaris
+> All.eq(Rpois, qpois (log(Ppois)-ep, lambda = 12, log.p=TRUE)) # fuzz for Solaris
[1] TRUE
-> All.eq(Rsignrank, qsignrank(log(Psignrank)-ep, n = 47, log=TRUE))
+> All.eq(Rsignrank, qsignrank(log(Psignrank)-ep, n = 47, log.p=TRUE))
[1] TRUE
-> All.eq(Rt, qt (log(Pt), df = 11, log=TRUE))
+> All.eq(Rt, qt (log(Pt), df = 11, log.p=TRUE))
[1] TRUE
-> All.eq(Rt2, qt (log(Pt2), df = 1.01, log=TRUE))
+> All.eq(Rt2, qt (log(Pt2), df = 1.01, log.p=TRUE))
[1] TRUE
-> All.eq(Runif, qunif (log(Punif), min = .2, max = 2, log=TRUE))
+> All.eq(Runif, qunif (log(Punif), min = .2, max = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rweibull, qweibull (log(Pweibull), shape = 3, scale = 2, log=TRUE))
+> All.eq(Rweibull, qweibull (log(Pweibull), shape = 3, scale = 2, log.p=TRUE))
[1] TRUE
-> All.eq(Rwilcox, qwilcox (log(Pwilcox)-ep, m = 13, n = 17, log=TRUE))
+> All.eq(Rwilcox, qwilcox (log(Pwilcox)-ep, m = 13, n = 17, log.p=TRUE))
[1] TRUE
>
> ## same q*(p* (log) log) with upper tail:
-> All.eq(Rbeta, qbeta (log1p(-Pbeta), shape1 = .8, shape2 = 2, lower=F, log=T))
+> All.eq(Rbeta, qbeta (log1p(-Pbeta), shape1 = .8, shape2 = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rbinom, qbinom (log1p(-Pbinom)+ep, size = 55, prob = pi/16, lower=F, log=T))
+> All.eq(Rbinom, qbinom (log1p(-Pbinom)+ep, size = 55, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rcauchy, qcauchy (log1p(-Pcauchy), location = 12, scale = 2, lower=F, log=T))
+> All.eq(Rcauchy, qcauchy (log1p(-Pcauchy), location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rchisq, qchisq (log1p(-Pchisq), df = 3, lower=F, log=T))
+> All.eq(Rchisq, qchisq (log1p(-Pchisq), df = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rexp, qexp (log1p(-Pexp), rate = 2, lower=F, log=T))
+> All.eq(Rexp, qexp (log1p(-Pexp), rate = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rf, qf (log1p(-Pf), df1 = 12, df2 = 6, lower=F, log=T))
+> All.eq(Rf, qf (log1p(-Pf), df1 = 12, df2 = 6, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rgamma, qgamma (log1p(-Pgamma), shape = 2, scale = 5, lower=F, log=T))
+> All.eq(Rgamma, qgamma (log1p(-Pgamma), shape = 2, scale = 5, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rgeom, qgeom (log1p(-Pgeom)+ep, prob = pi/16, lower=F, log=T))
+> All.eq(Rgeom, qgeom (log1p(-Pgeom)+ep, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rhyper, qhyper (log1p(-Phyper)+ep, m = 40, n = 30, k = 20, lower=F, log=T))
+> All.eq(Rhyper, qhyper (log1p(-Phyper)+ep, m = 40, n = 30, k = 20, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rlnorm, qlnorm (log1p(-Plnorm), meanlog = -1, sdlog = 3, lower=F, log=T))
+> All.eq(Rlnorm, qlnorm (log1p(-Plnorm), meanlog = -1, sdlog = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rlogis, qlogis (log1p(-Plogis), location = 12, scale = 2, lower=F, log=T))
+> All.eq(Rlogis, qlogis (log1p(-Plogis), location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rnbinom, qnbinom (log1p(-Pnbinom)+ep, size = 7, prob = .01, lower=F, log=T))
+> All.eq(Rnbinom, qnbinom (log1p(-Pnbinom)+ep, size = 7, prob = .01, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rnorm, qnorm (log1p(-Pnorm), mean = -1, sd = 3, lower=F, log=T))
+> All.eq(Rnorm, qnorm (log1p(-Pnorm), mean = -1, sd = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rpois, qpois (log1p(-Ppois)+ep, lambda = 12, lower=F, log=T))
+> All.eq(Rpois, qpois (log1p(-Ppois)+ep, lambda = 12, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rsignrank, qsignrank(log1p(-Psignrank)+ep, n = 47, lower=F, log=T))
+> All.eq(Rsignrank, qsignrank(log1p(-Psignrank)+ep, n = 47, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rt, qt (log1p(-Pt ), df = 11, lower=F, log=T))
+> All.eq(Rt, qt (log1p(-Pt ), df = 11, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rt2, qt (log1p(-Pt2), df = 1.01, lower=F, log=T))
+> All.eq(Rt2, qt (log1p(-Pt2), df = 1.01, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Runif, qunif (log1p(-Punif), min = .2, max = 2, lower=F, log=T))
+> All.eq(Runif, qunif (log1p(-Punif), min = .2, max = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rweibull, qweibull (log1p(-Pweibull), shape = 3, scale = 2, lower=F, log=T))
+> All.eq(Rweibull, qweibull (log1p(-Pweibull), shape = 3, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(Rwilcox, qwilcox (log1p(-Pwilcox)+ep, m = 13, n = 17, lower=F, log=T))
+> All.eq(Rwilcox, qwilcox (log1p(-Pwilcox)+ep, m = 13, n = 17, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
>
>
> ## Check log( upper.tail ):
-> All.eq(log1p(-Pbeta), pbeta (Rbeta, shape1 = .8, shape2 = 2, lower=F, log=T))
+> All.eq(log1p(-Pbeta), pbeta (Rbeta, shape1 = .8, shape2 = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pbinom), pbinom (Rbinom, size = 55, prob = pi/16, lower=F, log=T))
+> All.eq(log1p(-Pbinom), pbinom (Rbinom, size = 55, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pcauchy), pcauchy (Rcauchy, location = 12, scale = 2, lower=F, log=T))
+> All.eq(log1p(-Pcauchy), pcauchy (Rcauchy, location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pchisq), pchisq (Rchisq, df = 3, lower=F, log=T))
+> All.eq(log1p(-Pchisq), pchisq (Rchisq, df = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pexp), pexp (Rexp, rate = 2, lower=F, log=T))
+> All.eq(log1p(-Pexp), pexp (Rexp, rate = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pf), pf (Rf, df1 = 12, df2 = 6, lower=F, log=T))
+> All.eq(log1p(-Pf), pf (Rf, df1 = 12, df2 = 6, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pgamma), pgamma (Rgamma, shape = 2, scale = 5, lower=F, log=T))
+> All.eq(log1p(-Pgamma), pgamma (Rgamma, shape = 2, scale = 5, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pgeom), pgeom (Rgeom, prob = pi/16, lower=F, log=T))
+> All.eq(log1p(-Pgeom), pgeom (Rgeom, prob = pi/16, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Phyper), phyper (Rhyper, m = 40, n = 30, k = 20, lower=F, log=T))
+> All.eq(log1p(-Phyper), phyper (Rhyper, m = 40, n = 30, k = 20, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Plnorm), plnorm (Rlnorm, meanlog = -1, sdlog = 3, lower=F, log=T))
+> All.eq(log1p(-Plnorm), plnorm (Rlnorm, meanlog = -1, sdlog = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Plogis), plogis (Rlogis, location = 12, scale = 2, lower=F, log=T))
+> All.eq(log1p(-Plogis), plogis (Rlogis, location = 12, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pnbinom), pnbinom (Rnbinom, size = 7, prob = .01, lower=F, log=T))
+> All.eq(log1p(-Pnbinom), pnbinom (Rnbinom, size = 7, prob = .01, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pnorm), pnorm (Rnorm, mean = -1, sd = 3, lower=F, log=T))
+> All.eq(log1p(-Pnorm), pnorm (Rnorm, mean = -1, sd = 3, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Ppois), ppois (Rpois, lambda = 12, lower=F, log=T))
+> All.eq(log1p(-Ppois), ppois (Rpois, lambda = 12, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Psignrank), psignrank(Rsignrank, n = 47, lower=F, log=T))
+> All.eq(log1p(-Psignrank), psignrank(Rsignrank, n = 47, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pt), pt (Rt, df = 11, lower=F, log=T))
+> All.eq(log1p(-Pt), pt (Rt, df = 11, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pt2), pt (Rt2,df = 1.01, lower=F, log=T))
+> All.eq(log1p(-Pt2), pt (Rt2,df = 1.01, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Punif), punif (Runif, min = .2, max = 2, lower=F, log=T))
+> All.eq(log1p(-Punif), punif (Runif, min = .2, max = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pweibull), pweibull (Rweibull, shape = 3, scale = 2, lower=F, log=T))
+> All.eq(log1p(-Pweibull), pweibull (Rweibull, shape = 3, scale = 2, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
-> All.eq(log1p(-Pwilcox), pwilcox (Rwilcox, m = 13, n = 17, lower=F, log=T))
+> All.eq(log1p(-Pwilcox), pwilcox (Rwilcox, m = 13, n = 17, lower.tail=FALSE, log.p=TRUE))
[1] TRUE
>
>
diff --git a/tests/d-p-q-r-tst-2.R b/tests/d-p-q-r-tst-2.R
index 97df2e02e16..026067df0ab 100644
--- a/tests/d-p-q-r-tst-2.R
+++ b/tests/d-p-q-r-tst-2.R
@@ -46,29 +46,29 @@ PQonly <- c("tukey")
### (Extreme) tail tests added more recently:
-All.eq(1, -1e-17/ pexp(qexp(-1e-17, log=TRUE),log=TRUE))
-abs(pgamma(30,100, lower=FALSE, log=TRUE) + 7.3384686328784e-24) < 1e-36
+All.eq(1, -1e-17/ pexp(qexp(-1e-17, log.p=TRUE),log.p=TRUE))
+abs(pgamma(30,100, lower.tail=FALSE, log.p=TRUE) + 7.3384686328784e-24) < 1e-36
All.eq(1, pcauchy(-1e20) / 3.18309886183791e-21)
-All.eq(1, pcauchy(+1e15, log=TRUE) / -3.18309886183791e-16)## PR#6756
+All.eq(1, pcauchy(+1e15, log.p=TRUE) / -3.18309886183791e-16)## PR#6756
x <- 10^(ex <- c(1,2,5*(1:5),50,100,200,300,Inf))
for(a in x[ex > 10]) ## improve pt() : cbind(x,t= pt(-x, df=1), C=pcauchy(-x))
stopifnot(all.equal(pt(-a, df=1), pcauchy(-a), tolerance = 1e-15))
## for PR#7902:
ex <- -c(rev(1/x), ex)
All.eq(-x, qcauchy(pcauchy(-x)))
-All.eq(+x, qcauchy(pcauchy(+x, log=TRUE), log=TRUE))
+All.eq(+x, qcauchy(pcauchy(+x, log.p=TRUE), log.p=TRUE))
All.eq(1/x, pcauchy(qcauchy(1/x)))
-All.eq(ex, pcauchy(qcauchy(ex, log=TRUE), log=TRUE))
+All.eq(ex, pcauchy(qcauchy(ex, log.p=TRUE), log.p=TRUE))
II <- c(-Inf,Inf)
stopifnot(pcauchy(II) == 0:1, qcauchy(0:1) == II,
- pcauchy(II, log=TRUE) == c(-Inf,0),
- qcauchy(c(-Inf,0), log=TRUE) == II)
+ pcauchy(II, log.p=TRUE) == c(-Inf,0),
+ qcauchy(c(-Inf,0), log.p=TRUE) == II)
## PR#15521 :
p <- 1 - 1/4096
stopifnot(all.equal(qcauchy(p), 1303.7970381453319163, tolerance = 1e-14))
pr <- 1e-23 ## PR#6757
-stopifnot(all.equal(pr^ 12, pbinom(11, 12, prob= pr,lower=FALSE),
+stopifnot(all.equal(pr^ 12, pbinom(11, 12, prob= pr,lower.tail=FALSE),
tolerance = 1e-12, scale= 1e-270))
## pbinom(.) gave 0 in R 1.9.0
pp <- 1e-17 ## PR#6792
@@ -78,12 +78,12 @@ stopifnot(all.equal(2*pp, pgeom(1, pp), scale= 1e-20))
x <- 10^(100:295)
sapply(c(1e-250, 1e-25, 0.9, 1.1, 101, 1e10, 1e100),
function(shape)
- All.eq(-x, pgamma(x, shape=shape, lower=FALSE, log=TRUE)))
+ All.eq(-x, pgamma(x, shape=shape, lower.tail=FALSE, log.p=TRUE)))
x <- 2^(-1022:-900)
## where all completely off in R 2.0.1
-all.equal(pgamma(x, 10, log = TRUE) - 10*log(x),
+all.equal(pgamma(x, 10, log.p = TRUE) - 10*log(x),
rep(-15.104412573076, length(x)), tolerance = 1e-12)# 3.984e-14 (i386)
-all.equal(pgamma(x, 0.1, log = TRUE) - 0.1*log(x),
+all.equal(pgamma(x, 0.1, log.p = TRUE) - 0.1*log(x),
rep(0.0498724412598364, length(x)), tolerance = 1e-13)# 7e-16 (i386)
All.eq(dpois( 10*1:2, 3e-308, log=TRUE),
@@ -121,8 +121,8 @@ stopifnot(0 == qgamma(0, sh))
p <- 10:123*1e-12
qg <- qgamma(p, shape=19)
qg2<- qgamma(1:100 * 1e-9, shape=11)
-stopifnot(diff(qg, diff=2) < -6e-6,
- diff(qg2,diff=2) < -6e-6,
+stopifnot(diff(qg, differences=2) < -6e-6,
+ diff(qg2,differences=2) < -6e-6,
abs(1 - pgamma(qg, 19)/ p) < 1e-13,
All.eq(qg [1], 2.35047385139143),
All.eq(qg2[30], 1.11512318734547))
@@ -159,7 +159,7 @@ stopifnot(all.equal(dbeta(0.8, 0.5, 5, ncp=1000),# was way too small in R <= 2.6
)
## df(*, ncp):
-x <- seq(0, 10, length=101)
+x <- seq(0, 10, length.out=101)
h <- 1e-7
dx.h <- (pf(x+h, 7, 5, ncp= 2.5) - pf(x-h, 7, 5, ncp= 2.5)) / (2*h)
stopifnot(all.equal(dx.h, df(x, 7, 5, ncp= 2.5), tolerance = 1e-6),# (1.50 | 1.65)e-8
@@ -175,59 +175,59 @@ stopifnot(rerr < 1e-14)
## Similarly for df = 2 --- both for p ~ 0 *and* p ~ 1/2
## P ~ 0
-stopifnot(all.equal(qt(-740, df=2, log=TRUE), -exp(370)/sqrt(2)))
+stopifnot(all.equal(qt(-740, df=2, log.p=TRUE), -exp(370)/sqrt(2)))
## P ~ 1 (=> p ~ 0.5):
p.5 <- 0.5 + 2^(-5*(5:8))
stopifnot(all.equal(qt(p.5, df = 2),
c(8.429369702179e-08, 2.634178031931e-09,
8.231806349784e-11, 2.572439484308e-12)))
-## qt(, log = TRUE) is now more finite and monotone (again!):
-stopifnot(all.equal(qt(-1000, df = 4, log=TRUE),
+## qt(, log.p = TRUE) is now more finite and monotone (again!):
+stopifnot(all.equal(qt(-1000, df = 4, log.p=TRUE),
-4.930611e108, tolerance = 1e-6))
-qtp <- qt(-(20:850), df=1.2, log=TRUE, lower=FALSE)
+qtp <- qt(-(20:850), df=1.2, log.p=TRUE, lower.tail=FALSE)
##almost: stopifnot(all(abs(5/6 - diff(log(qtp))) < 1e-11))
-stopifnot(abs(5/6 - quantile(diff(log(qtp)), pr=c(0,0.995))) < 1e-11)
+stopifnot(abs(5/6 - quantile(diff(log(qtp)), probs=c(0,0.995))) < 1e-11)
## close to df=1 (where Taylor steps are important!):
-stopifnot(all.equal(-20, pt(qt(-20, df=1.02, log=TRUE),
- df=1.02, log=TRUE), tolerance = 1e-12),
- diff(lq <- log(qt(-2^-(10:600), df=1.1, log=TRUE))) > 0.6)
-lq1 <- log(qt(-2^-(20:600), df=1, log=TRUE))
-lq2 <- log(qt(-2^-(20:600), df=2, log=TRUE))
+stopifnot(all.equal(-20, pt(qt(-20, df=1.02, log.p=TRUE),
+ df=1.02, log.p=TRUE), tolerance = 1e-12),
+ diff(lq <- log(qt(-2^-(10:600), df=1.1, log.p=TRUE))) > 0.6)
+lq1 <- log(qt(-2^-(20:600), df=1, log.p=TRUE))
+lq2 <- log(qt(-2^-(20:600), df=2, log.p=TRUE))
stopifnot(mean(abs(diff(lq1) - log(2) )) < 1e-8,
mean(abs(diff(lq2) - log(sqrt(2)))) < 4e-8)
## Case, where log.p=TRUE was fine, but log.p=FALSE (default) gave NaN:
lp <- 40:406
-stopifnot(all.equal(lp, -pt(qt(exp(-lp), 1.2), 1.2, log=TRUE), tolerance = 4e-16))
+stopifnot(all.equal(lp, -pt(qt(exp(-lp), 1.2), 1.2, log.p=TRUE), tolerance = 4e-16))
## Other log.p cases, gave NaN (all but 1.1) in R <= 4.2.1, PR#18360 [NB: *still* inaccurate: tol=0.2]
q <- exp(seq(200, 500, by=1/2))
for(df in c(1.001, 1 + (1:10)/100)) {
- pq <- pt(q, df = df, log = TRUE)
- qpq <- qt(pq, df = df, log = TRUE)
- cat("df = ", df, ": all.equal(., tol=0): "); print(all.equal(q,qpq, tol=0)) # ~0.17!
+ pq <- pt(q, df = df, log.p = TRUE)
+ qpq <- qt(pq, df = df, log.p = TRUE)
+ cat("df = ", df, ": all.equal(., tol=0): "); print(all.equal(q,qpq, tolerance=0)) # ~0.17!
## plot(lp, 1-qpq/q, main=paste0("relErr(qt(., df=",df,"))"), type="l")
- stopifnot(all.equal(q,qpq, tol = 0.2)) # Lnx 64b: 1.001 shows 0.179
+ stopifnot(all.equal(q,qpq, tolerance = 0.2)) # Lnx 64b: 1.001 shows 0.179
if(any(ina <- is.na(qpq))) { cat("NaN in q-range: [", range(q[ina]),"]\n") }
}
-## pbeta(*, log=TRUE) {toms708} -- now improved tail behavior
+## pbeta(*, log.p=TRUE) {toms708} -- now improved tail behavior
x <- c(.01, .10, .25, .40, .55, .71, .98)
pbval <- c(-0.04605755624088, -0.3182809860569, -0.7503593555585,
-1.241555830932, -1.851527837938, -2.76044482378, -8.149862739881)
-stopifnot(all.equal(pbeta(x, 0.8, 2, lower=FALSE, log=TRUE), pbval),
- all.equal(pbeta(1-x, 2, 0.8, log=TRUE), pbval))
+stopifnot(all.equal(pbeta(x, 0.8, 2, lower.tail=FALSE, log.p=TRUE), pbval),
+ all.equal(pbeta(1-x, 2, 0.8, log.p=TRUE), pbval))
qq <- 2^(0:1022)
df.set <- c(0.1, 0.2, 0.5, 1, 1.2, 2.2, 5, 10, 20, 50, 100, 500)
for(nu in df.set) {
- pqq <- pt(-qq, df = nu, log=TRUE)
+ pqq <- pt(-qq, df = nu, log.p=TRUE)
stopifnot(is.finite(pqq))
}
## PR#14230 -- more extreme beta cases {should no longer rely on denormalized}
x <- (256:512)/1024
P <- pbeta(x, 3, 2200, lower.tail=FALSE, log.p=TRUE)
stopifnot(is.finite(P), P < -600,
- -.001 < (D3P <- diff(P, diff = 3)), D3P < 0, diff(D3P) < 0)
+ -.001 < (D3P <- diff(P, differences = 3)), D3P < 0, diff(D3P) < 0)
## all but the first 43 where -Inf in R <= 2.9.1
stopifnot(All.eq(pt(2^-30, df=10),
0.50000000036238542))
@@ -236,8 +236,8 @@ stopifnot(All.eq(pt(2^-30, df=10),
## rbinom(*, size) gave NaN for large size up to R <= 2.6.1
M <- .Machine$integer.max
set.seed(7) # as M is large, now "basically" rbinom(n, *) := qbinom(runif(n), *) :
-(tt <- table(rbinom(100, M, pr = 1e-9 )) ) # had values in {0,2} only
-(t2 <- table(rbinom(100, 10*M, pr = 1e-10)) )
+(tt <- table(rbinom(100, M, prob = 1e-9 )) ) # had values in {0,2} only
+(t2 <- table(rbinom(100, 10*M, prob = 1e-10)) )
stopifnot(0:6 %in% names(tt), sum(tt) == 100, sum(t2) == 100) ## no NaN there
## related qbinom() tests:
(binomOk <- b64 && !(Lnx && usingMKL)) # not for MKL on RHEL {R-dev.: 2023-06-22}
@@ -261,7 +261,7 @@ stopifnot(qf(1/4, Inf, Inf) == 1,
## qbeta(*, log.p) for "border" case:
stopifnot(is.finite(q0 <- qbeta(-1e10, 50,40, log.p=TRUE)),
- 1 == qbeta(-1e10, 2, 3, log.p=TRUE, lower=FALSE))
+ 1 == qbeta(-1e10, 2, 3, log.p=TRUE, lower.tail=FALSE))
## infinite loop or NaN in R <= 2.7.0
## phyper(x, 0,0,0), notably for huge x
@@ -298,7 +298,7 @@ stopifnot(abs(rErr(NB,P)) < 9*.Machine$double.eps)# seen 2.5*
## Non-central F for large x
x <- 1e16 * 1.1 ^ (0:20)
-dP <- diff(pf(x, df1=1, df2=1, ncp=20, lower.tail=FALSE, log=TRUE))
+dP <- diff(pf(x, df1=1, df2=1, ncp=20, lower.tail=FALSE, log.p=TRUE))
stopifnot(-0.047 < dP, dP < -0.0455)
## pf(*, log) jumped to -Inf prematurely in 2.8.0 and earlier
@@ -326,11 +326,11 @@ for(sz in sizes) {
## do_search() in qbinom() contained a thinko up to 2.9.0 (PR#13711)
-## pbeta(x, a,b, log=TRUE) for small x and a is ~ log-linear
+## pbeta(x, a,b, log.p=TRUE) for small x and a is ~ log-linear
x <- 2^-(200:10)
for(a in c(1e-8, 1e-12, 16e-16, 4e-16))
for(b in c(0.6, 1, 2, 10)) {
- dp <- diff(pbeta(x, a, b, log=TRUE)) # constant approximately
+ dp <- diff(pbeta(x, a, b, log.p=TRUE)) # constant approximately
stopifnot(sd(dp) / mean(dp) < 0.0007)
}
## had accidental cancellation '1 - w'
@@ -359,7 +359,7 @@ stopifnot(all(qpois((0:8)/8, lambda=0) == 0))
stopifnot(all.equal(pchisq(200, 4, ncp=.001, log.p=TRUE), -3.851e-42))
## jumped to zero too early up to R 2.10.1 (PR#14216)
## left "extreme tail"
-lp <- pchisq(2^-(0:200), 100, 1, log=TRUE)
+lp <- pchisq(2^-(0:200), 100, 1, log.p=TRUE)
stopifnot(is.finite(lp), lp < -184,
all.equal(lp[201], -7115.10693158))
dlp <- diff(lp)
@@ -367,7 +367,7 @@ dd <- abs(dlp[-(1:30)] - -34.65735902799)
stopifnot(-34.66 < dlp, dlp < -34.41, dd < 1e-8)# 2.2e-10 64bit Lnx
## underflowed to -Inf much too early in R <= 3.1.0
for(e in c(0, 2e-16))# continuity at 80 (= branch point)
-stopifnot(all.equal(pchisq(1:2, 1.01, ncp = 80*(1-e), log=TRUE),
+stopifnot(all.equal(pchisq(1:2, 1.01, ncp = 80*(1-e), log.p=TRUE),
c(-34.57369629, -31.31514671)))
## logit() == qlogit() on the right extreme:
@@ -377,8 +377,8 @@ stopifnot(All.eq(x, qlogis(plogis(x, log.p=TRUE),
## qlogis() gave Inf much too early for R <= 2.12.1
## Part 2:
x <- c(x, seq(700, 800, by=10))
-stopifnot(All.eq(x, qlogis(plogis(x, lower=FALSE, log.p=TRUE),
- lower=FALSE, log.p=TRUE)))
+stopifnot(All.eq(x, qlogis(plogis(x, lower.tail=FALSE, log.p=TRUE),
+ lower.tail=FALSE, log.p=TRUE)))
# plogis() underflowed to -Inf too early for R <= 2.15.0
## log upper tail pbeta():
@@ -406,19 +406,19 @@ stopifnot(abs(ldp - log(1/2)) < 1e-9)
## "stair function" effect (from denormalized numbers)
a <- 43779; b <- 0.06728
x. <- .9833 + (0:100)*1e-6
-px <- pbeta(x., a,b, log=TRUE) # plot(x., px) # -> "stair"
+px <- pbeta(x., a,b, log.p=TRUE) # plot(x., px) # -> "stair"
d2. <- diff(dpx <- diff(px))
-stopifnot(all.equal(px[1], -746.0986886924, tol=1e-12),
+stopifnot(all.equal(px[1], -746.0986886924, tolerance=1e-12),
0.0445741 < dpx, dpx < 0.0445783,
-4.2e-8 < d2., d2. < -4.18e-8)
## were way off in R <= 3.1.0
-c0 <- system.time(p0 <- pbeta( .9999, 1e30, 1.001, log=TRUE))
+c0 <- system.time(p0 <- pbeta( .9999, 1e30, 1.001, log.p=TRUE))
cB <- max(.001, c0[[1]])# base time
-c1 <- system.time(p1 <- pbeta(1- 1e-9, 1e30, 1.001, log=TRUE))
-c2 <- system.time(p2 <- pbeta(1-1e-12, 1e30, 1.001, log=TRUE))
-stopifnot(all.equal(p0, -1.000050003333e26, tol=1e-10),
- all.equal(p1, -1e21, tol = 1e-6),
+c1 <- system.time(p1 <- pbeta(1- 1e-9, 1e30, 1.001, log.p=TRUE))
+c2 <- system.time(p2 <- pbeta(1-1e-12, 1e30, 1.001, log.p=TRUE))
+stopifnot(all.equal(p0, -1.000050003333e26, tolerance=1e-10),
+ all.equal(p1, -1e21, tolerance = 1e-6),
all.equal(p2, -9.9997788e17),
c(c1[[1]], c2[[1]]) < 1000*cB)
## (almost?) infinite loop in R <= 3.1.0
@@ -454,7 +454,7 @@ stopifnot(all.equal(qlnorm(p, meanlog=1:2, sdlog=0),
## qbeta(*, a,b) when a,b << 1 : can easily fail
q1 <- qbeta(2^-28, 0.125, 2^-26) # gave 1000 Newton it + warning
-stopifnot(all.equal(2^-28, pbeta(q1, 0.125, 2^-26), tol= 2^-50))
+stopifnot(all.equal(2^-28, pbeta(q1, 0.125, 2^-26), tolerance= 2^-50))
a <- 1/8; b <- 2^-(4:200); alpha <- b/4
qq <- qbeta(alpha, a,b)# gave warnings intermediately
pp <- pbeta(qq, a,b)
@@ -472,10 +472,10 @@ pb <- c(## via Rmpfr's roundMpfr(pbetaI(x, a,b, log.p=TRUE, precBits = 2048), 64
-4320.30273911659058550, -5186.73671481652222237, -6919.60466621638549567,
-8652.47261761624876897, -10385.3405690161120427, -12118.2085204159753165,
-13851.0764718158385902, -15583.9444232157018631, -17316.8123746155651368)
-stopifnot(all.equal(pb, pbeta(x,a,b, log.p=TRUE), tol=8e-16))# seeing {1.5|1.6|2.0}e-16
+stopifnot(all.equal(pb, pbeta(x,a,b, log.p=TRUE), tolerance=8e-16))# seeing {1.5|1.6|2.0}e-16
qp <- qbeta(pb, a,b, log.p=TRUE)
## x == qbeta(pbeta(x, *), *) :
-stopifnot(qp > 0, all.equal(x, qp, tol= 1e-15))# seeing {2.4|3.3}e-16
+stopifnot(qp > 0, all.equal(x, qp, tolerance= 1e-15))# seeing {2.4|3.3}e-16
## qbeta(), PR#15755
a1 <- 0.0672788; b1 <- 226390
@@ -493,19 +493,19 @@ a <- 43779; b <- 0.06728
stopifnot(All.eq(0.695, pbeta(qbeta(0.695, b,a), b,a)))
x <- -exp(seq(0, 14, by=2^-9))
qx <- qbeta(x, a,b, log.p=TRUE)# used to be slow
-pqx <- pbeta(qx, a,b, log=TRUE)
+pqx <- pbeta(qx, a,b, log.p=TRUE)
stopifnot(diff(qx) < 0,
- all.equal(x, pqx, tol= 2e-15)) # seeing {3.51|3.54}e-16
+ all.equal(x, pqx, tolerance= 2e-15)) # seeing {3.51|3.54}e-16
## note that qx[x > -exp(2)] is too close to 1 to get full accuracy:
-i2 <- x > -exp(2); all.equal(x[i2], pqx[i2], tol= 0)#-> 5.849e-12
+i2 <- x > -exp(2); all.equal(x[i2], pqx[i2], tolerance= 0)#-> 5.849e-12
## was Inf, and much slower, for R <= 3.1.0
x3 <- -(15450:15700)/2^11
-pq3 <- pbeta(qbeta(x3, a,b, log.p=TRUE), a,b, log=TRUE)
+pq3 <- pbeta(qbeta(x3, a,b, log.p=TRUE), a,b, log.p=TRUE)
stopifnot(mean(abs(pq3-x3)) < 4e-12,# 1.46e-12
max (abs(pq3-x3)) < 8e-12)# 2.95e-12
##
.a <- .2; .b <- .03; lp <- -(10^-(1:323))
-qq <- qbeta(lp, .a,.b, log=TRUE) # warnings in R <= 3.1.0
+qq <- qbeta(lp, .a,.b, log.p=TRUE) # warnings in R <= 3.1.0
assertWarning(qN <- qbeta(.5, 2,3, log.p=TRUE))
assertWarning(qn <- qbeta(c(-.1, 1.25), 2,3))
stopifnot(1-qq < 1e-15, is.nan(qN), is.nan(qn))# typically qq == 1 exactly
@@ -528,9 +528,9 @@ stopifnot(is.finite(qb), qb < 1e-300, q2 == 1)
if(ct2 > 0.020) { cat("system.time:\n"); print(ct2) }
## had warnings and was much slower for R <= 3.1.0
-## qt(p, df= Inf, ncp) <==> qnorm(p, m=ncp)
+## qt(p, df= Inf, ncp) <==> qnorm(p, mean=ncp)
p <- (0:32)/32
-stopifnot(all.equal(qt(p, df=Inf, ncp=5), qnorm(p, m=5)))
+stopifnot(all.equal(qt(p, df=Inf, ncp=5), qnorm(p, mean=5)))
## qt(*, df=Inf, .) gave NaN in R <= 3.2.1
## rhyper(*, ); PR#16489
@@ -557,7 +557,7 @@ stopifnot(rchisq(32, df=0, ncp=0) == 0,
## pchisq(*, df=0, ncp > 0, log.p=TRUE) :
th <- 10*c(1:9,10^c(1:3,7))
pp <- pchisq(0, df = 0, ncp=th, log.p=TRUE)
-stopifnot(all.equal(pp, -th/2, tol=1e-15))
+stopifnot(all.equal(pp, -th/2, tolerance=1e-15))
## underflowed at about th ~= 60 in R <= 3.2.2
## pnbinom (-> C's bratio())
@@ -590,8 +590,8 @@ q <- qnbinom(pp, mu = mu, size = Inf) # gave all NaN
set.seed(1); NI <- rnbinom(32, mu = mu, size = Inf)# gave all NaN
set.seed(1); N2 <- rnbinom(32, mu = mu, size = L )
stopifnot(exprs = {
- all.equal(d, c(0.006737947, 0.033689735, 0.0842243375, 0.140373896, 0,0,0,0), tol = 9e-9)# 7.6e-10
- all.equal(p, c(0.006737947, 0.040427682, 0.1246520195, 0.265025915, 1,1,1,1), tol = 9e-9)# 7.3e-10
+ all.equal(d, c(0.006737947, 0.033689735, 0.0842243375, 0.140373896, 0,0,0,0), tolerance = 9e-9)# 7.6e-10
+ all.equal(p, c(0.006737947, 0.040427682, 0.1246520195, 0.265025915, 1,1,1,1), tolerance = 9e-9)# 7.3e-10
all.equal(d, dpois(x, mu))# current implementation: even identical()
all.equal(p, ppois(x, mu))
q == c(0, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, Inf)
@@ -653,7 +653,7 @@ p <- 1e-10
qbet <- qbeta(p, 1.5, shape2=sh2, lower.tail=FALSE)
plot(sh2, pbeta(qbet, 1.5, sh2, lower.tail=FALSE)/p -1 -> rE, log="x", main="rel.Error")
dqb <- diff(qbet); d2qb <- diff(dqb); d3qb <- diff(d2qb)
-stopifnot(all.equal(qbet[[1]], 0.047206901483498, tol=1e-12),
+stopifnot(all.equal(qbet[[1]], 0.047206901483498, tolerance=1e-12),
print(max(abs(rE))) < 1e-12, # Lx 64b: 2.4e-13
0 > dqb, dqb > -0.002,
0 < d2qb, d2qb < 0.00427,
@@ -690,11 +690,11 @@ stopifnot(sum(x <= 201) == 100000)
## had if(!(onWindows && arch == "x86"))
## PR#17577 - dgamma(x, shape) for shape < 1 (=> +Inf at x=0) and very small x
stopifnot(exprs = {
- all.equal(dgamma(2^-1027, shape = .99 , log=TRUE), 7.1127667376, tol=1e-10)
- all.equal(dgamma(2^-1031, shape = 1e-2, log=TRUE), 702.8889158, tol=1e-10)
- all.equal(dgamma(2^-1048, shape = 1e-7, log=TRUE), 710.30007699, tol=1e-10)
+ all.equal(dgamma(2^-1027, shape = .99 , log=TRUE), 7.1127667376, tolerance=1e-10)
+ all.equal(dgamma(2^-1031, shape = 1e-2, log=TRUE), 702.8889158, tolerance=1e-10)
+ all.equal(dgamma(2^-1048, shape = 1e-7, log=TRUE), 710.30007699, tolerance=1e-10)
all.equal(dgamma(2^-1048, shape = 1e-7, scale = 1e-315, log=TRUE),
- 709.96858768, tol=1e-10)
+ 709.96858768, tolerance=1e-10)
})
## all gave Inf in R <= 3.6.1
## } else cat("PR#17577 bug fix not checked, as it may not work on this platform\n")
@@ -713,20 +713,20 @@ stopifnot(exprs = {
qs <- 2^seq(0, 155, by=1/8)
lp <- pnorm( qs, log.p=TRUE, lower.tail=FALSE)
lp. <- pnorm(-qs, log.p=TRUE)
-stopifnot(all.equal(lp, lp., tol= 4e-16)) # actually exactly via code-identity
+stopifnot(all.equal(lp, lp., tolerance= 4e-16)) # actually exactly via code-identity
## Both these gave NaNs (and warned about it):
qpU <- qnorm(lp, log.p=TRUE, lower.tail=FALSE)
qp. <- qnorm(lp, log.p=TRUE)
## Show the (mostly) small differences :
-all.equal( qs, qpU, tol=0)
-all.equal(-qs, qp., tol=0)
-all.equal(-qp.,qpU, tol=0) # typically TRUE (<==> exact equality)
+all.equal( qs, qpU, tolerance=0)
+all.equal(-qs, qp., tolerance=0)
+all.equal(-qp.,qpU, tolerance=0) # typically TRUE (<==> exact equality)
## however,
range(qpU/qs - 1) # -5.68e-6 5.41e-6 in R <= 4.2.1
stopifnot(exprs = {
- all.equal( qs, qpU, tol=1e-15)
- all.equal(-qs, qp., tol=1e-15)
- all.equal(-qp., qpU, tol=1e-15)# diff of 4.71e-16 in 4.1.0 w/icc (Eric Weese)
+ all.equal( qs, qpU, tolerance=1e-15)
+ all.equal(-qs, qp., tolerance=1e-15)
+ all.equal(-qp., qpU, tolerance=1e-15)# diff of 4.71e-16 in 4.1.0 w/icc (Eric Weese)
max(abs(qpU/qs - 1)) < 1e-15 # see 4.44e-16 {was 5.68e-6 in R <= 4.2.1; much larger in R <= 4.0.x)
})
## both failed very badly in R <= 4.0.x
@@ -735,7 +735,7 @@ stopifnot(exprs = {
x <- seq(134.5, 189, by=.5)
px <- pnorm(-x * 1e152, log.p=TRUE)# all these underflowed previously
stopifnot(exprs = {
- all.equal(-1.79769313486073e+308, pnorm(-1.896150381621e154, log.p=TRUE), tol=1e-14)
+ all.equal(-1.79769313486073e+308, pnorm(-1.896150381621e154, log.p=TRUE), tolerance=1e-14)
is.finite(px)
abs(1 - diff(diff(px)) / -2.5e303) < 3e-11 * (1 + (.Machine$sizeof.longdouble < 12))
})
@@ -826,7 +826,7 @@ stopifnot(exprs = {
is.finite(ldpxx)
print(abs(print(dpois(L,L))/ (1/sqrt(2*pi)/sqrt(L)) -1)) < 1e-15 # see 1.11e-16
abs(range(dlp) - d) < 1e-12 # seen 4.4e-14, was NaN in R <= 4.1.1
- all.equal(ldpxx, log(dpxx), tol = 1e-15)
+ all.equal(ldpxx, log(dpxx), tolerance = 1e-15)
})
## dpois(x,x) underflowed to zero in R <= 4.1.1 for such large x.
diff --git a/tests/datetime4.R b/tests/datetime4.R
index cd2c8ed3eaa..d4732c7c80c 100644
--- a/tests/datetime4.R
+++ b/tests/datetime4.R
@@ -53,7 +53,7 @@ as.Date(c(7e11, 8e11, -7e11, -8e11))
## handling of names
# conversion of R objects
-x <- seq(as.Date("2022-09-01"), by = "weeks", length = 10)
+x <- seq(as.Date("2022-09-01"), by = "weeks", length.out = 10)
names(x) <- paste("week", 1:10)
x
(xl <- as.POSIXlt(x))
@@ -77,12 +77,12 @@ y2 <- paste(y, "10:01:02"); names(y2) <- names(y)
fmt <- c("%Y-%m-%d", "%Y-%m-%d %H:%M:%S", "%Y-%m-%d %H:%M:%S %Z")
(strptime(y2, fmt[1:2]) -> sy2)
## IGNORE_RDIFF_END
-sy2.15 <- strptime(y2, rep(fmt[1:2], length = 15)) # failed to recycle names
+sy2.15 <- strptime(y2, rep(fmt[1:2], length.out = 15)) # failed to recycle names
stopifnot(suppressWarnings(sy2 == sy2.15))
xl. <- xl[1:9] # length(fmt) == 3 -- fully recycles in xl.
(strftime(xl., fmt) -> sx)
-(strftime(xl., rep(fmt, length = 15)) -> sx15)
+(strftime(xl., rep(fmt, length.out = 15)) -> sx15)
stopifnot(exprs = { # with warnings ".. length is not a multiple of shorter .."
sx == sx15
names(sx) == names(sx15)
@@ -93,4 +93,4 @@ x2$year <- xl$year[1:3]
x2 # correctly has missing names as NA
balancePOSIXlt(x2) # recycles names
strftime(x2, fmt)
-strftime(x2, rep(fmt, length = 10))
+strftime(x2, rep(fmt, length.out = 10))
diff --git a/tests/datetime4.Rout.save b/tests/datetime4.Rout.save
index 27fbf578746..54be6d463dd 100644
--- a/tests/datetime4.Rout.save
+++ b/tests/datetime4.Rout.save
@@ -187,7 +187,7 @@ Warning in strptime("2022-01-01 -1500", "%Y-%m-%d %z", tz = "UTC") :
>
> ## handling of names
> # conversion of R objects
-> x <- seq(as.Date("2022-09-01"), by = "weeks", length = 10)
+> x <- seq(as.Date("2022-09-01"), by = "weeks", length.out = 10)
> names(x) <- paste("week", 1:10)
> x
week 1 week 2 week 3 week 4 week 5 week 6
@@ -330,7 +330,7 @@ attr(,"balanced")
week 9 week 10
"2022-10-27 00:00:00 CEST" "2022-11-03 10:01:02 CET"
> ## IGNORE_RDIFF_END
-> sy2.15 <- strptime(y2, rep(fmt[1:2], length = 15)) # failed to recycle names
+> sy2.15 <- strptime(y2, rep(fmt[1:2], length.out = 15)) # failed to recycle names
> stopifnot(suppressWarnings(sy2 == sy2.15))
>
> xl. <- xl[1:9] # length(fmt) == 3 -- fully recycles in xl.
@@ -341,7 +341,7 @@ attr(,"balanced")
"2022-09-22" "2022-09-29 00:00:00" "2022-10-06 00:00:00 UTC"
week 7 week 8 week 9
"2022-10-13" "2022-10-20 00:00:00" "2022-10-27 00:00:00 UTC"
-> (strftime(xl., rep(fmt, length = 15)) -> sx15)
+> (strftime(xl., rep(fmt, length.out = 15)) -> sx15)
week 1 week 2 week 3
"2022-09-01" "2022-09-08 00:00:00" "2022-09-15 00:00:00 UTC"
week 4 week 5 week 6
@@ -378,7 +378,7 @@ Warning in names(sx) == names(sx15) :
"2022-09-01" "2022-09-08 00:00:00" "2022-09-15 00:00:00 UTC"
"2022-09-22" "2022-09-29 00:00:00"
-> strftime(x2, rep(fmt, length = 10))
+> strftime(x2, rep(fmt, length.out = 10))
week 1 week 2 week 3
"2022-09-01" "2022-09-08 00:00:00" "2022-09-15 00:00:00 UTC"
week 1
diff --git a/tests/demos.Rout.save b/tests/demos.Rout.save
index 5e2c21c9a8b..4a22738f981 100644
--- a/tests/demos.Rout.save
+++ b/tests/demos.Rout.save
@@ -129,7 +129,7 @@ $warnings[[2]]
> r <- withWarnings({ log(-1) + sqrt(-4); exp(1) })
-> str(r, digits=14)
+> str(r, digits.d=14)
List of 2
$ value : num 2.718281828459
$ warnings:List of 2
@@ -236,7 +236,7 @@ List of 3
+ ".Random.seed", ".Traceback")
> ls.base <- Filter(function(nm) is.na(match(nm, xtraBaseNms)),
-+ ls("package:base", all=TRUE))
++ ls("package:base", all.names=TRUE))
> base.is.f <- sapply(ls.base, function(x) is.function(get(x)))
@@ -629,13 +629,13 @@ logical(0)
> all(ispi[is0.ok] == is0)
[1] TRUE
-> is.ALL(numeric(0), true=TRUE)
+> is.ALL(numeric(0), true.only=TRUE)
[1] "is.atomic" "is.double" "is.numeric" "is.vector"
-> is.ALL(array(1,1:3), true=TRUE)
+> is.ALL(array(1,1:3), true.only=TRUE)
[1] "is.array" "is.atomic" "is.double" "is.numeric"
-> is.ALL(cbind(1:3), true=TRUE)
+> is.ALL(cbind(1:3), true.only=TRUE)
[1] "is.array" "is.atomic" "is.integer" "is.matrix" "is.numeric"
> is.ALL(structure(1:7, names = paste("a",1:7,sep="")))
@@ -1040,7 +1040,7 @@ Error in ross$withdraw(500) : You don't have that much money!
> axis(2, col.axis="blue", las=1)
-> axis(1, at=1:12, lab=month.abb, col.axis="blue")
+> axis(1, at=1:12, labels=month.abb, col.axis="blue")
> box()
@@ -1582,9 +1582,9 @@ smooth> lines(sm, col = 2, lwd = 1.25)
> ## Didactical investigation:
>
> showSmooth <- function(x, leg.x = 1, leg.y = max(x)) {
-+ ss <- cbind(x, "3c" = smooth(x, "3", end="copy"),
++ ss <- cbind(x, "3c" = smooth(x, "3", endrule="copy"),
+ "3" = smooth(x, "3"),
-+ "3Rc" = smooth(x, "3R", end="copy"),
++ "3Rc" = smooth(x, "3R", endrule="copy"),
+ "3R" = smooth(x, "3R"),
+ sm = smooth(x))
+ k <- ncol(ss) - 1
diff --git a/tests/eval-etc.R b/tests/eval-etc.R
index 129c6127f00..00d53ee688f 100644
--- a/tests/eval-etc.R
+++ b/tests/eval-etc.R
@@ -144,8 +144,8 @@ stopifnot(
grepl("1L, NA_integer_", CO(withAutoprint(x <- c(1L, NA_integer_, NA))))
,
identical(CO(r1 <- withAutoprint({ formals(withAutoprint); body(withAutoprint) })),
- CO(r2 <- source(expr = list(quote(formals(withAutoprint)),
- quote(body(withAutoprint)) ),
+ CO(r2 <- source(exprs = list(quote(formals(withAutoprint)),
+ quote(body(withAutoprint)) ),
echo=TRUE))),
identical(r1,r2)
)
diff --git a/tests/eval-etc.Rout.save b/tests/eval-etc.Rout.save
index 047903fe883..965df6b9ac7 100644
--- a/tests/eval-etc.Rout.save
+++ b/tests/eval-etc.Rout.save
@@ -201,8 +201,8 @@ Levels: a b
+ grepl("1L, NA_integer_", CO(withAutoprint(x <- c(1L, NA_integer_, NA))))
+ ,
+ identical(CO(r1 <- withAutoprint({ formals(withAutoprint); body(withAutoprint) })),
-+ CO(r2 <- source(expr = list(quote(formals(withAutoprint)),
-+ quote(body(withAutoprint)) ),
++ CO(r2 <- source(exprs = list(quote(formals(withAutoprint)),
++ quote(body(withAutoprint)) ),
+ echo=TRUE))),
+ identical(r1,r2)
+ )
diff --git a/tests/lapack.R b/tests/lapack.R
index eb3251250a5..6e1ae9ab04d 100644
--- a/tests/lapack.R
+++ b/tests/lapack.R
@@ -67,22 +67,22 @@ Ceigenok <- function(A, E, Eps=1000*.Machine$double.eps)
## failed for some 64bit-Lapack-gcc combinations:
sm <- cbind(1, 3:1, 1:3)
eigenok(sm, eigen(sm))
-eigenok(sm, eigen(sm, sym=FALSE))
+eigenok(sm, eigen(sm, symmetric=FALSE))
set.seed(123)
sm <- matrix(rnorm(25), 5, 5)
sm <- 0.5 * (sm + t(sm))
eigenok(sm, eigen(sm))
-eigenok(sm, eigen(sm, sym=FALSE))
+eigenok(sm, eigen(sm, symmetric=FALSE))
sm[] <- as.complex(sm)
Ceigenok(sm, eigen(sm))
-Ceigenok(sm, eigen(sm, sym=FALSE))
+Ceigenok(sm, eigen(sm, symmetric=FALSE))
sm[] <- sm + rnorm(25) * 1i
sm <- 0.5 * (sm + Conj(t(sm)))
Ceigenok(sm, eigen(sm))
-Ceigenok(sm, eigen(sm, sym=FALSE))
+Ceigenok(sm, eigen(sm, symmetric=FALSE))
## ------- tests of integer matrices -----------------
@@ -96,7 +96,7 @@ tcrossprod(A)
solve(A)
qr(A)
-determinant(A, log = FALSE)
+determinant(A, logarithm = FALSE)
rcond(A)
rcond(A, "I")
@@ -132,7 +132,7 @@ tcrossprod(A)
Q <- qr(A)
zapsmall(Q$qr)
zapsmall(Q$qraux)
-determinant(A, log = FALSE) # 0
+determinant(A, logarithm = FALSE) # 0
rcond(A)
rcond(A, "I")
diff --git a/tests/lapack.Rout.save b/tests/lapack.Rout.save
index 4a3b01b9611..b6536e8176c 100644
--- a/tests/lapack.Rout.save
+++ b/tests/lapack.Rout.save
@@ -89,7 +89,7 @@ Type 'q()' to quit R.
[2,] 0.5774 0.1690 -0.2357
[3,] 0.5774 -0.5071 -0.2357
[1] 5 1 0
-> eigenok(sm, eigen(sm, sym=FALSE))
+> eigenok(sm, eigen(sm, symmetric=FALSE))
[,1] [,2] [,3]
[1,] 0.5774 0.8452 0.9428
[2,] 0.5774 0.1690 -0.2357
@@ -107,7 +107,7 @@ Type 'q()' to quit R.
[4,] 0.1404 0.7985 -0.41848 0.094314 -0.3983
[5,] -0.3946 -0.1285 0.05768 0.872692 -0.2507
[1] 1.7814 1.5184 0.5833 -1.0148 -2.4908
-> eigenok(sm, eigen(sm, sym=FALSE))
+> eigenok(sm, eigen(sm, symmetric=FALSE))
[,1] [,2] [,3] [,4] [,5]
[1,] 0.6329 0.5899 0.1683 0.471808 0.02315
[2,] -0.2838 0.1936 0.2931 -0.009784 0.89217
@@ -125,7 +125,7 @@ Type 'q()' to quit R.
[4,] 0.1404+0i 0.7985+0i -0.41848+0i 0.094314+0i -0.3983+0i
[5,] -0.3946+0i -0.1285+0i 0.05768+0i 0.872692+0i -0.2507+0i
[1] 1.7814 1.5184 0.5833 -1.0148 -2.4908
-> Ceigenok(sm, eigen(sm, sym=FALSE))
+> Ceigenok(sm, eigen(sm, symmetric=FALSE))
[,1] [,2] [,3] [,4] [,5]
[1,] 0.6329+0i 0.5899+0i 0.1683+0i 0.471808+0i 0.02315+0i
[2,] -0.2838+0i 0.1936+0i 0.2931+0i -0.009784+0i 0.89217+0i
@@ -150,7 +150,7 @@ Type 'q()' to quit R.
[4,] -0.3654+0.04183i
[5,] -0.2229-0.30121i
[1] 2.4043 1.3934 0.7854 -1.4050 -2.8006
-> Ceigenok(sm, eigen(sm, sym=FALSE))
+> Ceigenok(sm, eigen(sm, symmetric=FALSE))
[,1] [,2] [,3] [,4]
[1,] 0.6383+0.00000i 0.5373+0.00000i 0.428339+0.09065i 0.05039-0.329984i
[2,] -0.1909-0.20935i 0.3051+0.04099i -0.107969+0.28126i -0.12013+0.008395i
@@ -220,7 +220,7 @@ $pivot
attr(,"class")
[1] "qr"
-> determinant(A, log = FALSE)
+> determinant(A, logarithm = FALSE)
$modulus
[1] 9368
attr(,"logarithm")
@@ -339,7 +339,7 @@ $v
[5,] 0.5774 -0.5164 -0.6803 -0.3136 0.0000
> zapsmall(Q$qraux)
[1] 1.000 1.258 1.731 1.950 0.000
-> determinant(A, log = FALSE) # 0
+> determinant(A, logarithm = FALSE) # 0
$modulus
[1] 0
attr(,"logarithm")
diff --git a/tests/lm-tests.R b/tests/lm-tests.R
index f82a511da9b..1cf8795ba0b 100644
--- a/tests/lm-tests.R
+++ b/tests/lm-tests.R
@@ -20,15 +20,15 @@ predict(roller.glm0, type="terms")# failed till 2003-03-31
stopifnot(exprs = {
all.equal(residuals(roller.glm0, type = "partial"),
- residuals(roller.lm0, type = "partial"), tol = 1e-14) # 4.0e-16
+ residuals(roller.lm0, type = "partial"), tolerance = 1e-14) # 4.0e-16
all.equal(deviance(roller.lm),
- deviance(roller.glm), tol = 1e-14) # 2.4e-16
+ deviance(roller.glm), tolerance = 1e-14) # 2.4e-16
all.equal(weighted.residuals(roller.lm),
- residuals (roller.glm), tol = 2e-14) # 9.17e-16
+ residuals (roller.glm), tolerance = 2e-14) # 9.17e-16
all.equal(deviance(roller.lm0),
- deviance(roller.glm0), tol = 1e-14) # 2.78e-16
- all.equal(weighted.residuals(roller.lm0, drop=FALSE),
- residuals (roller.glm0), tol = 2e-14) # 6.378e-16
+ deviance(roller.glm0), tolerance = 1e-14) # 2.78e-16
+ all.equal(weighted.residuals(roller.lm0, drop0=FALSE),
+ residuals (roller.glm0), tolerance = 2e-14) # 6.378e-16
})
(im.lm0 <- influence.measures(roller.lm0))
@@ -52,7 +52,7 @@ stopifnot(exprs = {
all.equal(summary(roller.lm0)$coefficients,
summary(roller.lm9)$coefficients, tolerance = 1e-14)
- all.equal(print(anova(roller.lm0), signif.st=FALSE),
+ all.equal(print(anova(roller.lm0), signif.stars=FALSE),
anova(roller.lm9), tolerance = 1e-14)
})
diff --git a/tests/lm-tests.Rout.save b/tests/lm-tests.Rout.save
index 6502fc4b738..ae8e2d8ead6 100644
--- a/tests/lm-tests.Rout.save
+++ b/tests/lm-tests.Rout.save
@@ -50,15 +50,15 @@ attr(,"constant")
>
> stopifnot(exprs = {
+ all.equal(residuals(roller.glm0, type = "partial"),
-+ residuals(roller.lm0, type = "partial"), tol = 1e-14) # 4.0e-16
++ residuals(roller.lm0, type = "partial"), tolerance = 1e-14) # 4.0e-16
+ all.equal(deviance(roller.lm),
-+ deviance(roller.glm), tol = 1e-14) # 2.4e-16
++ deviance(roller.glm), tolerance = 1e-14) # 2.4e-16
+ all.equal(weighted.residuals(roller.lm),
-+ residuals (roller.glm), tol = 2e-14) # 9.17e-16
++ residuals (roller.glm), tolerance = 2e-14) # 9.17e-16
+ all.equal(deviance(roller.lm0),
-+ deviance(roller.glm0), tol = 1e-14) # 2.78e-16
-+ all.equal(weighted.residuals(roller.lm0, drop=FALSE),
-+ residuals (roller.glm0), tol = 2e-14) # 6.378e-16
++ deviance(roller.glm0), tolerance = 1e-14) # 2.78e-16
++ all.equal(weighted.residuals(roller.lm0, drop0=FALSE),
++ residuals (roller.glm0), tolerance = 2e-14) # 6.378e-16
+ })
>
> (im.lm0 <- influence.measures(roller.lm0))
@@ -95,7 +95,7 @@ Influence measures of
+
+ all.equal(summary(roller.lm0)$coefficients,
+ summary(roller.lm9)$coefficients, tolerance = 1e-14)
-+ all.equal(print(anova(roller.lm0), signif.st=FALSE),
++ all.equal(print(anova(roller.lm0), signif.stars=FALSE),
+ anova(roller.lm9), tolerance = 1e-14)
+ })
Analysis of Variance Table
diff --git a/tests/no-segfault.Rin b/tests/no-segfault.Rin
index fb99a291c54..2b0cdba107c 100644
--- a/tests/no-segfault.Rin
+++ b/tests/no-segfault.Rin
@@ -109,7 +109,7 @@ for (pkg in core.pkgs) {
this.pos <- match(paste("package", pkg, sep=":"), search())
lib.not.loaded <- is.na(this.pos)
if(lib.not.loaded) {
- library(pkg, character = TRUE, warn.conflicts = FALSE)
+ library(pkg, character.only = TRUE, warn.conflicts = FALSE)
cat("library(", pkg, ")\n")
}
this.pos <- match(paste("package", pkg, sep=":"), search())
diff --git a/tests/p-qbeta-strict-tst.R b/tests/p-qbeta-strict-tst.R
index a8350e37825..ec27ab00d99 100644
--- a/tests/p-qbeta-strict-tst.R
+++ b/tests/p-qbeta-strict-tst.R
@@ -56,13 +56,13 @@ lpb <- c(
-3575.16952001464937783, -3557.84084050065074512, -3540.51216098665211240,
-3523.18348147265347947, -3505.85480195865484676, -3488.52612244465621405,
-3471.19744293065758134, -3453.86876341665894863)
-stopifnot( all.equal(lpb, pbeta(x,a,b,log.=TRUE), tol=2e-16) )# pbeta() check
+stopifnot( all.equal(lpb, pbeta(x,a,b,log.p=TRUE), tolerance=2e-16) )# pbeta() check
qpb <- qbeta(lpb, a,b, log.p=TRUE)
stopifnot(qpb > 0)# ok R >= 3.2.0, not in R 3.1.x
## ideally x == qbeta(pbeta(x, *), *) :
-all.equal(x, qpb, tol=0)# now 4.5666e-15; was 5.238e-15, then 4.986e-15
+all.equal(x, qpb, tolerance=0)# now 4.5666e-15; was 5.238e-15, then 4.986e-15
(relE <- relErr(x, qpb)) # 4.5666e-15
stopifnot(relE < 4e-14)
@@ -110,7 +110,7 @@ lp1 <- c(
-232.900727843423843350, -235.066790448639183389, -237.232854907576249937,
-239.398921066369763294, -241.564988783926857030, -243.731057930866643141,
-245.897128388547890981, -248.063200048177428608)
-stopifnot( all.equal(lp1, pbeta(x1,a,b,log.=TRUE), tol=2e-16) )# pbeta() check
+stopifnot( all.equal(lp1, pbeta(x1,a,b,log.p=TRUE), tolerance=2e-16) )# pbeta() check
qp1 <- qbeta(lp1, a,b, log.p=TRUE)
stopifnot(qp1 > 0)
@@ -127,50 +127,50 @@ qp1. <- qbeta(p1, a,b)
## TODO? maybe change log_q_cut = -5 to ~ -2 (for this example; it really should depend on (a,b) ..
relE. <- 1 - qp1./x1
-stopifnot(all.equal(qp1, qp1., tol=8*.Machine$double.eps),
+stopifnot(all.equal(qp1, qp1., tolerance=8*.Machine$double.eps),
print(mean(abs(relE.))) < 2e-15, # 3.9023e-16 was 3.9572e-16, 4.0781e-16
print(max (abs(relE.))) < 7e-15 ) # 1.1102e-15; was 1.3323e-15
proc.time() - .pt; .pt <- proc.time()
a <- 43779; b <- 0.06728; x <- -exp(901/256)
-(qx <- qbeta(x , a,b, log=TRUE)) ## now 3 N iter. in x-scale; had 157 iter. in log_x scale
+(qx <- qbeta(x , a,b, log.p=TRUE)) ## now 3 N iter. in x-scale; had 157 iter. in log_x scale
## 0.9993614
-(pq <- pbeta(qx, a,b, log=TRUE)) ## = -33.7686
+(pq <- pbeta(qx, a,b, log.p=TRUE)) ## = -33.7686
stopifnot(print(abs(1 - pq/x)) < 1e-15) # rel.err ~ 8.88e-16 "perfect"
## but it uses probably the wrong swap_tail decision...
-curve(pbeta(exp(x), a,b, log=TRUE), -1e-3, -1e-7, n=1025) # "the same" as
+curve(pbeta(exp(x), a,b, log.p=TRUE), -1e-3, -1e-7, n=1025) # "the same" as
par(new=TRUE)
-curve(pbeta( x, a,b, log=TRUE), 0.999, 1-1e-7, col=2, ylab="", xaxt="n"); axis(3)
+curve(pbeta( x, a,b, log.p=TRUE), 0.999, 1-1e-7, col=2, ylab="", xaxt="n"); axis(3)
abline(v = qx, h = x, col="light blue", lty = 2); mtext(line=-1, sprintf("(a=%g, b=%g)",a,b))
## as is this one -- the mirror image:
(x. <- log1p(-exp(x))) # -2.160156e-15
-(q. <- qbeta(x., b,a, log=TRUE, lower.tail=FALSE))# very quick convergence: u0 is perfect
+(q. <- qbeta(x., b,a, log.p=TRUE, lower.tail=FALSE))# very quick convergence: u0 is perfect
## 1.425625e-223
-(p. <- pbeta(q., b,a, log=TRUE, lower.tail=FALSE))
-stopifnot(all.equal(p., x., tol = 1e-15))
+(p. <- pbeta(q., b,a, log.p=TRUE, lower.tail=FALSE))
+stopifnot(all.equal(p., x., tolerance = 1e-15))
## very different picture at the *other tail*:
-(q2 <- qbeta(x., b,a, log=TRUE)) ## 0.0006386087
-stopifnot(all.equal(x., pbeta(q2, b,a, log=TRUE), tol= 1e-13)) # Lx 64b: 2.37e-15
+(q2 <- qbeta(x., b,a, log.p=TRUE)) ## 0.0006386087
+stopifnot(all.equal(x., pbeta(q2, b,a, log.p=TRUE), tolerance= 1e-13)) # Lx 64b: 2.37e-15
-curve(pbeta(x, b,a, log=TRUE), 1e-30, .5, n=1025, log="x")
+curve(pbeta(x, b,a, log.p=TRUE), 1e-30, .5, n=1025, log="x")
# Flip vertically and use log scale ==> "close" to -x. = 2.160156e-15
-curve(-pbeta(x, b,a, log=TRUE), 1e-8, .005, n=1025, log="xy")
+curve(-pbeta(x, b,a, log.p=TRUE), 1e-8, .005, n=1025, log="xy")
abline(v = q2, h = -x., lty=3, col=2)
### more extreme (a,b) [still computable with Rmpfr pbetaI():]
a <- 800; b <- 2
x <- 2^-c(10*(100:4), 37, 2*(17:14), 27:2, (8:1)/8)
-curve(pbeta(x,a,b, log=TRUE), n=1025, log="x", 1e-200, .1); mtext(R.version.string)
+curve(pbeta(x,a,b, log.p=TRUE), n=1025, log="x", 1e-200, .1); mtext(R.version.string)
axis(1, at=0.1, padj=-1); abline(h=0, v=.1, lty=2); mtext(line=-1, sprintf("(a=%g, b=%g)",a,b))
if(interactive() && require(Rmpfr)) {
pbi <- pbetaI(x, a,b, log.p=TRUE, precBits = 2048)
## plus experiments, to see that 2048 bits are way enough ...
dput(format(roundMpfr(pbi, 64))) ##
- stopifnot( all.equal(pbi, pbeta(x,a,b,log.=TRUE), tol=2e-16) )
+ stopifnot( all.equal(pbi, pbeta(x,a,b,log.p=TRUE), tolerance=2e-16) )
} ## plus manual editing, removing all ' " ' :
lp2 <- c(-554511.058587009179178, -548965.881142529616682, -543420.703698050054243,
@@ -219,16 +219,16 @@ lp2 <- c(-554511.058587009179178, -548965.881142529616682, -543420.7036980500542
-479.303685612597087790, -410.103507771019607286, -340.930746845646155091,
-271.797948987745926763, -202.728589967468744076, -133.775198381652975971,
-65.1041210297877634069)
-stopifnot( all.equal(lp2, pbeta(x,a,b,log.=TRUE), tol=2e-16) )# pbeta() check
+stopifnot( all.equal(lp2, pbeta(x,a,b,log.p=TRUE), tolerance=2e-16) )# pbeta() check
qp2 <- qbeta(lp2, a,b, log.p=TRUE)# 7 precision warnings in R <= 3.1.0
pq2 <- pbeta(qp2, a,b, log.p=TRUE)
stopifnot(qp2 > 0, is.finite(pq2))
## ideally x == qbeta(pbeta(x, *), *) :
-all.equal( x, qp2, tol=0)# 2.075e-16 was 1.956845e-08, but .. *misleading* a bit
-all.equal(log(x), log(qp2), tol=0)# 1.676e-16 was 1.0755 !!
+all.equal( x, qp2, tolerance=0)# 2.075e-16 was 1.956845e-08, but .. *misleading* a bit
+all.equal(log(x), log(qp2), tolerance=0)# 1.676e-16 was 1.0755 !!
## ideally lp2 == pbeta(qbeta(lp2, *), *) :
-all.equal(lp2, pq2, tol=0)# 1.26e-16; was 1.07...
+all.equal(lp2, pq2, tolerance=0)# 1.26e-16; was 1.07...
relE <- 1 - qp2/x
rel2 <- 1 - pq2/lp2
stopifnot(print(mean(abs(relE))) < 7e-14, # 1.53e-14 was 0.9913043 (R 3.1.0), then 0.8521738
@@ -241,7 +241,7 @@ proc.time() - .pt; .pt <- proc.time()
### even more extreme (a,b) [still computable with Rmpfr pbetaI():]
a <- 2^12; b <- 2
x <- 2^-c(10*(100:2), 17, 2*(7:4), 7:1, .5, .25)
-curve(pbeta(x,a,b, log=TRUE), n=1025, log="x", 1e-300, .1)
+curve(pbeta(x,a,b, log.p=TRUE), n=1025, log="x", 1e-300, .1)
mtext(paste("(a=2^12, b=2) --", R.version.string))
abline(h=0, v=1, lty=3); axis(1, at=1, padj=-1, col.axis=2)
@@ -249,7 +249,7 @@ if(interactive() && require(Rmpfr)) {
pbi <- pbetaI(x, a,b, log.p=TRUE, precBits = 2048)
## plus experiments, to see that 2048 bits are way enough ...
dput(format(roundMpfr(pbi, 64))) ##
- stopifnot( all.equal(pbi, pbeta(x,a,b,log.=TRUE), tol=2e-16) )
+ stopifnot( all.equal(pbi, pbeta(x,a,b,log.p=TRUE), tolerance=2e-16) )
} ## plus manual editing, removing all ' " ' :
lp3 <- c(-2839122.53356325844061, -2810731.22504752308055, -2782339.91653178772071,
@@ -290,16 +290,16 @@ lp3 <- c(-2839122.53356325844061, -2810731.22504752308055, -2782339.916531787720
-17026.4828436463425554, -14187.3679884148968711, -11348.2699182657980446,
-8509.20804096757424162, -5670.23129358494148988, -2831.50574442529708752,
-1412.47477359632328309, -703.301613239304818981)
-stopifnot( all.equal(lp3, pbeta(x,a,b,log.=TRUE), tol=2e-16) )# pbeta() check
+stopifnot( all.equal(lp3, pbeta(x,a,b,log.p=TRUE), tolerance=2e-16) )# pbeta() check
qp3 <- qbeta(lp3, a,b, log.p=TRUE)
pq3 <- pbeta(qp3, a,b, log.p=TRUE)
stopifnot(qp3 > 0, is.finite(pq3))
## ideally x == qbeta(pbeta(x, *), *) :
-all.equal( x, qp3, tol=0)# 1.599e-16
-all.equal(log(x), log(qp3), tol=0)# 1.405e-16
+all.equal( x, qp3, tolerance=0)# 1.599e-16
+all.equal(log(x), log(qp3), tolerance=0)# 1.405e-16
## ideally lp3 == pbeta(qbeta(lp3, *), *) :
-all.equal(lp3, pq3, tol=0)# 1.07... then TRUE!
+all.equal(lp3, pq3, tolerance=0)# 1.07... then TRUE!
relE <- 1 - qp3/x
rel2 <- 1 - pq3/lp3
stopifnot(print(mean(abs(rel2))) < 3e-15,# 0 !!
@@ -410,7 +410,7 @@ chk_relE(qbetShRelErr(0.967, 0.035, lower.tail=TRUE, xI = c(4.84642, 26.162)), 8
chk_relE(qbetShRelErr(0.966, 0.035, lower.tail=TRUE, xI = c(6.99119, 44.4524)), 8e-16, 1e-15) # had warnings
chk_relE(qbetShRelErr(0.965, 0.035, lower.tail=TRUE), 8e-16, 1e-15)# 0 0 {much changed picture ...}
pp. <- c(.965, .966)
-stopifnot(all.equal(tol = 1e-15, pp.,
+stopifnot(all.equal(tolerance = 1e-15, pp.,
pbeta(print(qbeta(pp., .0035, .097)),
.0035, .097)))
@@ -422,7 +422,7 @@ qbeta(.80, 1/100, 1/200)# gives 1 without a warning -- which *is* good:
(qb.2 <- qbeta(.20, 1/200, 1/100)) # 2.613271e-105
(pqb.2 <- pbeta(qb.2, 1/200, 1/100))# 0.2 -- very good:
0.2 - pqb.2 # -2.77..e-17
-stopifnot(all.equal(0.2, pqb.2, tol = 1e-15))
+stopifnot(all.equal(0.2, pqb.2, tolerance = 1e-15))
## completely different picture: smaller values; increasing -- max (~ 2.4) -- decreasing (????)
chk_relE(qbetShRelErr(0.96 , 0.035, to= 15, lower.tail=TRUE), 8e-16, 1e-15)# completely different (mostly decreasing, no bump)
@@ -453,30 +453,30 @@ qbeta(.0193, 1/200, 1/100) # 1.038564e-299 + warning .. not accurate
## PR#18302 (about qf(), really about qbeta()) ====================
options(warn=2) # no warnings
qq <- qf(-37.4, df1 = 227473.5, df2 = 2.066453, log.p = TRUE)
-stopifnot(all.equal(0.027519098277, qq, tol=2e-11))
+stopifnot(all.equal(0.027519098277, qq, tolerance=2e-11))
x <- lseq(1e-300, 1, 1000) # 1e-300 2e-300 .... 0.25.. 0.50.. 1.0
q2L <- qf(log(x), df1 = 23e4, df2 = 2, log.p=TRUE)
stopifnot(all.equal(log(x), pf(q2L, df1=23e4, df2=2, log.p=TRUE)))
xN <- -300+ (-27:7)/2
qb. <- qbeta(xN, 1, 115000, lower.tail=FALSE, log.p=TRUE)
pqb <- pbeta(qb., 1, 115000, lower.tail=FALSE, log.p=TRUE)
-stopifnot(all.equal(xN, pqb, tol=1e-14))
- all.equal(xN, pqb, tol=0) # ... 1.86e-16
+stopifnot(all.equal(xN, pqb, tolerance=1e-14))
+ all.equal(xN, pqb, tolerance=0) # ... 1.86e-16
x <- seq(-700, 0, by=1/2); x <- x[x < 0] # x == 0 <==> qf = +Inf
qfx <- qf(x, df1 = 23e4, df2 = 2, log.p=TRUE) # gave 71 warnings
stopifnot(0 < qfx, qfx < 2) # and even
stopifnot(all.equal(x, pf(qfx, df1 = 23e4, df2 = 2, log.p=TRUE)))
- all.equal(x, pf(qfx, df1 = 23e4, df2 = 2, log.p=TRUE), tol=0) # 5.6e-15
+ all.equal(x, pf(qfx, df1 = 23e4, df2 = 2, log.p=TRUE), tolerance=0) # 5.6e-15
## log.p=FALSE [default] cases that failed (or gave warnings)
ps <- lseq(1e-300, 0.1, 1001)
qf. <- qf(ps , df1 = 227473.5, df2 = 2.06)
pqpf <- pf(qf., df1 = 227473.5, df2 = 2.06)
- all.equal(ps, pqpf, tol = 0) # rel.diff. 7.41309e-16
-stopifnot(all.equal(ps, pqpf, tol = 8e-15))
+ all.equal(ps, pqpf, tolerance = 0) # rel.diff. 7.41309e-16
+stopifnot(all.equal(ps, pqpf, tolerance = 8e-15))
qps <- qbeta(ps, 1.03, 115000, lower.tail = FALSE)# works (35 u-Newton steps)
pqp <- pbeta(qps, 1.03, 115000, lower.tail = FALSE)
- all.equal(ps, pqp, tol = 0) # rel.diff. 1.150378e-15
-stopifnot(all.equal(ps, pqp, tol = 1e-14))
+ all.equal(ps, pqp, tolerance = 0) # rel.diff. 1.150378e-15
+stopifnot(all.equal(ps, pqp, tolerance = 1e-14))
## NB: there are *still* gaps for other df-pairs -- but *only* from pbeta() bpser underflow problems there
@@ -490,19 +490,19 @@ x <- 1e-311*2^(-2:5)
a <- 9.9999e-16
##==> all work via apser():
-all.equal(x^a, pbeta(x, a, 1), tol=0) # 1.11e-16 -- perfect
-all.equal(a*log(x), pbeta(x, a, 1, log=TRUE), tol=0)# 3.5753e-13 -- less perfect
+all.equal(x^a, pbeta(x, a, 1), tolerance=0) # 1.11e-16 -- perfect
+all.equal(a*log(x), pbeta(x, a, 1, log.p=TRUE), tolerance=0)# 3.5753e-13 -- less perfect
## only very slightly larger a:
a <- 1e-15
-all.equal(x^a, p <- pbeta(x, a, 1), tol=0)# bgrat() underflow warnings # 7.12208e-13
+all.equal(x^a, p <- pbeta(x, a, 1), tolerance=0)# bgrat() underflow warnings # 7.12208e-13
## numbers are very close to 1 ==> not such a problem
cbind(x, "x^a" = x^a, pbeta = p, relE = p/(x^a) - 1,
"1-x^a (expm1)" = -expm1(a*log(x)), "1-pb" = 1-p,
## interestingly, even this does *not* improve the situation:
"pb_upp" = pbeta(x, a, 1, lower.tail=FALSE))
-all.equal(a*log(x), pL <- pbeta(x, a, 1, log=TRUE), tol=0)#
+all.equal(a*log(x), pL <- pbeta(x, a, 1, log.p=TRUE), tolerance=0)#
## 0.853 ... catastrophic! -- it's off for x <= 8e-311 :
cbind(x, "a*log" = a*log(x), pbetaL = pL, relE = pL/(a*log(x)) - 1)
@@ -513,9 +513,9 @@ try.pb <- function(x, a,b, log.p=TRUE)
tryCatch(pbeta(x, a,b, log.p=log.p), error=identity, warning=identity)
check.pb <- function(pb, true)
stopifnot((inherits(pb, "warning") && grepl("\\bInf\\b", pb$message)) ||
- isTRUE(all.equal(print(pb), true, tol = 2e-7))) # << print(.) : see value
+ isTRUE(all.equal(print(pb), true, tolerance = 2e-7))) # << print(.) : see value
-## True values via require(Rmpfr); asNumeric(pbetaI(326/512, 1900, 38, log=TRUE))
+## True values via require(Rmpfr); asNumeric(pbetaI(326/512, 1900, 38, log.p=TRUE))
##
## Those with*out* a '#' mark all did *not* underflow in R 2.9.1, nor R 2.10.1,
## but did give NaN in 2.11.x (x >= 0) and -Inf later === *regression* _FIXME_
diff --git a/tests/print-tests.R b/tests/print-tests.R
index bcafe7e8976..690cf963f6e 100644
--- a/tests/print-tests.R
+++ b/tests/print-tests.R
@@ -122,8 +122,8 @@ fm <- lapply(nonFin, format)
w <- c(4,3,2,3)
stopifnot(sapply(lapply(fm, nchar), max) == w,
mm == rbind(w, 0, 0))# m[2,] was 2147483647; m[3,] was 1
-cnF <- c(lapply(nonFin, function(x) complex(re=x, im=x))[-3],
- complex(re=NaN, im=-Inf))
+cnF <- c(lapply(nonFin, function(x) complex(real=x, imaginary=x))[-3],
+ complex(real=NaN, imaginary=-Inf))
cmm <- sapply(cnF, format.info)
cfm <- lapply(cnF, format)
cw <- sapply(lapply(cfm, nchar), max)
@@ -156,7 +156,7 @@ outer(z, 0:6, signif) # had NaN's till 1.1.1
olddig <- options(digits=14) # RH6.0 fails at 15
z <- 1.234567891234567e27
-for(dig in 1:14) cat(formatC(dig,w=2),
+for(dig in 1:14) cat(formatC(dig,width=2),
format(z, digits=dig), signif(z, digits=dig), "\n")
options(olddig)
# The following are tests of printf inside formatC
diff --git a/tests/print-tests.Rout.save b/tests/print-tests.Rout.save
index 34d914e6ca1..7539e7458a3 100644
--- a/tests/print-tests.Rout.save
+++ b/tests/print-tests.Rout.save
@@ -251,8 +251,8 @@ Type 'q()' to quit R.
> w <- c(4,3,2,3)
> stopifnot(sapply(lapply(fm, nchar), max) == w,
+ mm == rbind(w, 0, 0))# m[2,] was 2147483647; m[3,] was 1
-> cnF <- c(lapply(nonFin, function(x) complex(re=x, im=x))[-3],
-+ complex(re=NaN, im=-Inf))
+> cnF <- c(lapply(nonFin, function(x) complex(real=x, imaginary=x))[-3],
++ complex(real=NaN, imaginary=-Inf))
> cmm <- sapply(cnF, format.info)
> cfm <- lapply(cnF, format)
> cw <- sapply(lapply(cfm, nchar), max)
@@ -311,7 +311,7 @@ Type 'q()' to quit R.
>
> olddig <- options(digits=14) # RH6.0 fails at 15
> z <- 1.234567891234567e27
-> for(dig in 1:14) cat(formatC(dig,w=2),
+> for(dig in 1:14) cat(formatC(dig,width=2),
+ format(z, digits=dig), signif(z, digits=dig), "\n")
1 1e+27 1e+27
2 1.2e+27 1.2e+27
diff --git a/tests/reg-S4.R b/tests/reg-S4.R
index 39d5bfaa097..b49c48da23d 100644
--- a/tests/reg-S4.R
+++ b/tests/reg-S4.R
@@ -54,7 +54,7 @@ stopifnot(identical(f("B", "C"), paste(c("A","B"), "C")),
identical(xy, c("A", "B", "Z")))
## trace a method
-trace("f", sig = c("character", "character"), quote(x <- c(x, "D")),
+trace("f", signature = c("character", "character"), quote(x <- c(x, "D")),
exit = quote(xy <<- xyy <<- c(x, "W")), print = FALSE)
stopifnot(identical(f("B", "C"), paste(c("A","B","D"), "C")))
diff --git a/tests/reg-S4.Rout.save b/tests/reg-S4.Rout.save
index 40a2a4b775b..b2a0413e71c 100644
--- a/tests/reg-S4.Rout.save
+++ b/tests/reg-S4.Rout.save
@@ -95,7 +95,7 @@ Reference class object of class "envRefClass"
+ identical(xy, c("A", "B", "Z")))
>
> ## trace a method
-> trace("f", sig = c("character", "character"), quote(x <- c(x, "D")),
+> trace("f", signature = c("character", "character"), quote(x <- c(x, "D")),
+ exit = quote(xy <<- xyy <<- c(x, "W")), print = FALSE)
[1] "f"
>
diff --git a/tests/reg-tests-1a.R b/tests/reg-tests-1a.R
index c06cebba74a..0391621a4d7 100644
--- a/tests/reg-tests-1a.R
+++ b/tests/reg-tests-1a.R
@@ -16,7 +16,7 @@ cbind(Sys.getenv(envLst))
assertError <- tools::assertError
## regression test for PR#376
-aggregate(ts(1:20), nfreq=1/3)
+aggregate(ts(1:20), nfrequency=1/3)
## Comments: moved from aggregate.Rd
@@ -107,8 +107,8 @@ r <- rbind(c(1,2,3),
r %*% y # == x = (8,4,2)
( y2 <- backsolve(r, x, transpose = TRUE)) # 8 -12 -5
stopifnot(all.equal(drop(t(r) %*% y2), x))
-stopifnot(all.equal(y, backsolve(t(r), x, upper = FALSE, transpose = TRUE)))
-stopifnot(all.equal(y2, backsolve(t(r), x, upper = FALSE, transpose = FALSE)))
+stopifnot(all.equal(y, backsolve(t(r), x, upper.tri = FALSE, transpose = TRUE)))
+stopifnot(all.equal(y2, backsolve(t(r), x, upper.tri = FALSE, transpose = FALSE)))
## end of moved from backsolve.Rd
@@ -120,11 +120,11 @@ dirname(character(0))
## Bessel
## Check the Scaling :
nus <- c(0:5,10,20)
-x <- seq(0,40,len=801)[-1]
+x <- seq(0,40,length.out=801)[-1]
for(nu in nus)
- stopifnot(abs(1- besselK(x,nu)*exp( x) / besselK(x,nu,expo=TRUE)) < 2e-15)
+ stopifnot(abs(1- besselK(x,nu)*exp( x) / besselK(x,nu,expon.scaled=TRUE)) < 2e-15)
for(nu in nus)
- stopifnot(abs(1- besselI(x,nu)*exp(-x) / besselI(x,nu,expo=TRUE)) < 1e-15)
+ stopifnot(abs(1- besselI(x,nu)*exp(-x) / besselI(x,nu,expon.scaled=TRUE)) < 1e-15)
## end of moved from Bessel.Rd
@@ -203,7 +203,7 @@ stopifnot(
month.abb == substr(month.name, 1, 3)
)
-stopifnot(all.equal(pi, 4*atan(1), tol= 2*Meps))
+stopifnot(all.equal(pi, 4*atan(1), tolerance= 2*Meps))
# John Machin (1705) computed 100 decimals of pi :
stopifnot(all.equal(pi/4, 4*atan(1/5) - atan(1/239), 4*Meps))
@@ -241,8 +241,8 @@ y <- 1
stopifnot(eval(D.sc) ==
attr(eval(dxy),"gradient")[,"x"])
ff <- y ~ sin(cos(x) * y)
-stopifnot(all.equal(deriv(ff, c("x","y"), func = TRUE ),
- deriv(ff, c("x","y"), func = function(x,y){ } )))
+stopifnot(all.equal(deriv(ff, c("x","y"), function.arg = TRUE ),
+ deriv(ff, c("x","y"), function.arg = function(x,y){ } )))
## end of moved from deriv.Rd
@@ -269,7 +269,7 @@ stopifnot(duplicated(iris)[143] == TRUE)
set.seed(321, kind = "default") # force a particular seed
m <- matrix(round(rnorm(25),3), 5,5)
sm <- m + t(m) #- symmetric matrix
-em <- eigen(sm); V <- em$vect
+em <- eigen(sm); V <- em$vectors
print(lam <- em$values) # ordered DEcreasingly
stopifnot(
@@ -278,7 +278,7 @@ stopifnot(
##------- Symmetric = FALSE: -- different to above : ---
-em <- eigen(sm, symmetric = FALSE); V2 <- em$vect
+em <- eigen(sm, symmetric = FALSE); V2 <- em$vectors
print(lam2 <- em$values) # ordered decreasingly in ABSolute value !
print(i <- rev(order(lam2)))
stopifnot(abs(lam - lam2[i]) < 100 * Meps) # comparing two solns
@@ -334,14 +334,14 @@ for(N in 1:130) {
## findint
N <- 100
X <- sort(round(rt(N, df=2), 2))
-tt <- c(-100, seq(-2,2, len=201), +100)
+tt <- c(-100, seq(-2,2, length.out=201), +100)
it <- findInterval(tt, X)
## See that this is N * Fn(.) :
tt <- c(tt,X)
stopifnot(it[c(1,203)] == c(0, 100),
all.equal(N * stats::ecdf(X)(tt),
- findInterval(tt, X), tol = 100 * Meps),
+ findInterval(tt, X), tolerance = 100 * Meps),
findInterval(tt,X) == apply( outer(tt, X, ">="), 1, sum)
)
## end of moved from findint.Rd
@@ -389,7 +389,7 @@ y <- rnorm(20)
y1 <- y[-1]; y2 <- y[-20]
summary(g1 <- glm(y1 - y2 ~ 1))
summary(g2 <- glm(y1 ~ offset(y2)))
-Eq <- function(x,y) all.equal(x,y, tol = 1e-12)
+Eq <- function(x,y) all.equal(x,y, tolerance = 1e-12)
stopifnot(Eq(coef(g1), coef(g2)),
Eq(deviance(g1), deviance(g2)),
Eq(resid(g1), resid(g2)))
@@ -419,7 +419,7 @@ structure(list(Treat = factor(c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
anorex.1 <- glm(Postwt ~ Prewt + Treat + offset(Prewt),
family = gaussian, data = anorexia)
summary(anorex.1)
-Eq <- function(x,y) all.equal(x,y, tol = 1e-12)
+Eq <- function(x,y) all.equal(x,y, tolerance = 1e-12)
stopifnot(Eq(AIC(anorex.1), anorex.1$aic),
Eq(AIC(g1), g1$aic),
Eq(AIC(g2), g2$aic))
@@ -432,7 +432,7 @@ stopifnot(all.equal(as.vector(lmx), as.vector(glmx)),
## Hyperbolic
-x <- seq(-3, 3, len=200)
+x <- seq(-3, 3, length.out=200)
stopifnot(
abs(cosh(x) - (exp(x) + exp(-x))/2) < 20*Meps,
abs(sinh(x) - (exp(x) - exp(-x))/2) < 20*Meps,
@@ -453,22 +453,22 @@ stopifnot(abs(acosh(cx) - log(cx + sqrt(cx^2 - 1))) < 1000*Meps)
## Degenerate, should still work
image(as.matrix(1))
image(matrix(pi,2,4))
-x <- seq(0,1,len=100)
+x <- seq(0,1,length.out=100)
image(x, 1, matrix(x), col=heat.colors(10))
image(x, 1, matrix(x), col=heat.colors(10), oldstyle = TRUE)
-image(x, 1, matrix(x), col=heat.colors(10), breaks = seq(0.1,1.1,len=11))
+image(x, 1, matrix(x), col=heat.colors(10), breaks = seq(0.1,1.1,length.out=11))
## end of moved from image.Rd
## integrate
(ii <- integrate(dnorm, -1.96, 1.96))
(i1 <- integrate(dnorm, -Inf, Inf))
-stopifnot(all.equal(0.9500042097, ii$val, tol = ii$abs.err, scale=1),
- all.equal( 1, i1$val, tol = i1$abs.err, scale=1))
+stopifnot(all.equal(0.9500042097, ii$value, tolerance = ii$abs.error, scale=1),
+ all.equal( 1, i1$value, tolerance = i1$abs.error, scale=1))
integrand <- function(x) {1/((x+1)*sqrt(x))}
(ii <- integrate(integrand, lower = 0, upper = Inf, rel.tol = 1e-10))
-stopifnot(all.equal(pi, ii$val, tol = ii$abs.err, scale=1))
+stopifnot(all.equal(pi, ii$value, tolerance = ii$abs.error, scale=1))
## end of moved from integrate.Rd
@@ -554,11 +554,11 @@ stopifnot(Mod(1+exp(pi*1i)) < 10* Meps)
## logistic
eps <- 100 * Meps
x <- c(0:4, rlogis(100))
-stopifnot(all.equal(plogis(x), 1 / (1 + exp(-x)), tol = eps))
-stopifnot(all.equal(plogis(x, lower=FALSE), exp(-x)/ (1 + exp(-x)), tol = eps))
-stopifnot(all.equal(plogis(x, lower=FALSE, log=TRUE), -log(1 + exp(x)),
- tol = eps))
-stopifnot(all.equal(dlogis(x), exp(x) * (1 + exp(x))^-2, tol = eps))
+stopifnot(all.equal(plogis(x), 1 / (1 + exp(-x)), tolerance = eps))
+stopifnot(all.equal(plogis(x, lower.tail=FALSE), exp(-x)/ (1 + exp(-x)), tolerance = eps))
+stopifnot(all.equal(plogis(x, lower.tail=FALSE, log.p=TRUE), -log(1 + exp(x)),
+ tolerance = eps))
+stopifnot(all.equal(dlogis(x), exp(x) * (1 + exp(x))^-2, tolerance = eps))
## end of moved from Logistic.Rd
@@ -596,7 +596,7 @@ all.equal(m, N * pr/sum(pr)) # rel.error ~0.003
stopifnot(max(abs(m/(N*pr/sum(pr)) - 1)) < 0.01)
(Pr <- dmultinom(c(0,0,3), prob = c(1, 1, 14)))
-stopifnot(all.equal(Pr, dbinom(3, 3, p = 14/16)))
+stopifnot(all.equal(Pr, dbinom(3, 3, prob = 14/16)))
X <- t(as.matrix(expand.grid(0:3, 0:3)))
X <- X[, colSums(X) <= 3]
@@ -642,7 +642,7 @@ stopifnot((1 - X /( Q %*% R))< 100*Meps)
dim(Qc <- qr.Q(qrstr, complete=TRUE)) # Square: dim(Qc) == rep(nrow(x),2)
stopifnot((crossprod(Qc) - diag(nrow(x))) < 10*Meps)
-QD <- qr.Q(qrstr, D=1:p) # QD == Q \%*\% diag(1:p)
+QD <- qr.Q(qrstr, Dvec=1:p) # QD == Q \%*\% diag(1:p)
stopifnot(QD - Q %*% diag(1:p) < 8* Meps)
dim(Rc <- qr.R(qrstr, complete=TRUE)) # == dim(x)
@@ -806,8 +806,8 @@ stopifnot(is.infinite(.Machine$double.base ^ .Machine$double.max.exp))
## PR 640 (diff.default computes an incorrect starting time)
## By: Laimonis Kavalieris
-y <- ts(rnorm(24), freq=12)
-x <- ts(rnorm(24), freq=12)
+y <- ts(rnorm(24), frequency=12)
+x <- ts(rnorm(24), frequency=12)
arima0(y, xreg = x, seasonal = list(order=c(0,1,0)))
## Comments:
@@ -816,7 +816,7 @@ arima0(y, xreg = x, seasonal = list(order=c(0,1,0)))
## By: Uwe Ligges
x <- matrix(c(2, 2, 4, 8, 6, 0, 1, 1, 7, 8, 1, 3, 1, 3, 7, 4, 2, 2, 2,
1, 1, 0, 0, 0, 0, 0, 1, 1, 2, 0, 1, 1, 0, 2, 1, 0, 0, 0),
- nc = 2)
+ ncol = 2)
fisher.test(x)
## Comments: (wasn't just on Windows)
@@ -1143,8 +1143,8 @@ y <- c(2.55, 12.07, 0.46, 0.35, 2.69, -0.94, 1.73, 0.73, -0.35, -0.37)
KSxy <- ks.test(x, y)
stopifnot(exprs = {
round(KSxy$p.value, 4) == 0.0524
- all.equal(c(D = 0.6), KSxy$statistic, tol = 1e-15) # see 1.85 e-16
- all.equal( 15/286, KSxy$p.value, tol = 1e-15) # " 2.646e-16
+ all.equal(c(D = 0.6), KSxy$statistic, tolerance = 1e-15) # see 1.85 e-16
+ all.equal( 15/286, KSxy$p.value, tolerance = 1e-15) # " 2.646e-16
})
## PR 1150. Wilcoxon rank sum and signed rank tests did not return the
@@ -1220,8 +1220,8 @@ stopifnot(all.equal(sign(resid(glm2,"response")),sign(resid(glm2,"pearson"))))
# shouldn't depend on link for a saturated model
x<-rep(0:1,10)
y<-rep(c(0,1,1,0,1),4)
-glm3<-glm(y~x,family=binomial(),control=glm.control(eps=1e-8))
-glm4<-glm(y~x,family=binomial("log"),control=glm.control(eps=1e-8))
+glm3<-glm(y~x,family=binomial(),control=glm.control(epsilon=1e-8))
+glm4<-glm(y~x,family=binomial("log"),control=glm.control(epsilon=1e-8))
stopifnot(all.equal(resid(glm3,"pearson"),resid(glm4,"pearson")))
@@ -1236,7 +1236,7 @@ cancor(matrix(rnorm(100),100,1), matrix(rnorm(300),100,3))
## PR#1201: incorrect values in qbeta
-x <- seq(0, 0.8, len=1000)
+x <- seq(0, 0.8, length.out=1000)
xx <- pbeta(qbeta(x, 0.143891, 0.05), 0.143891, 0.05)
stopifnot(max(abs(x - xx)) < 1e-6)
## Comments: Get a range of zeroes in 1.3.1
@@ -1274,16 +1274,16 @@ DF <- data.frame(counts = c(18, 17, 15, 20, 10, 20, 25, 13, 12),
fit <- glm(counts ~ outcome + treatment + offset(log(exposure)),
family = poisson, data = DF)
p1 <- predict(fit)
-p2 <- predict(fit, se = TRUE) ## failed < 1.4.1
+p2 <- predict(fit, se.fit = TRUE) ## failed < 1.4.1
p3 <- predict(fit, newdata = DF)
-p4 <- predict(fit, newdata = DF, se = TRUE)
+p4 <- predict(fit, newdata = DF, se.fit = TRUE)
stopifnot(all.equal(p1, p2$fit), all.equal(p1, p3), all.equal(p2, p4))
fit <- glm(counts ~ outcome + treatment, offset = log(exposure),
family = poisson, data = DF)
p1 <- predict(fit)
-p2 <- predict(fit, se = TRUE) ## failed < 1.4.1
+p2 <- predict(fit, se.fit = TRUE) ## failed < 1.4.1
p3 <- predict(fit, newdata = DF)
-p4 <- predict(fit, newdata = DF, se = TRUE)
+p4 <- predict(fit, newdata = DF, se.fit = TRUE)
stopifnot(all.equal(p1, p2$fit), all.equal(p1, p3), all.equal(p2, p4))
@@ -1330,12 +1330,12 @@ stopifnot(identical(dimnames(c1), dimnames(c2)),
identical(dimnames(qr.qty(q4,y40)), dimnames(y40)),
identical(dimnames(qr.qy (q4,y04)), dimnames(y04)),
- all.equal(y1, qr.fitted(q4, y1 ), tol = 1e-12),
- all.equal(y4, qr.fitted(q4, y4 ), tol = 1e-12),
- all.equal(y40, qr.fitted(q4, y40), tol = 1e-12),
- all.equal(y04, qr.fitted(q4, y04), tol = 1e-12),
+ all.equal(y1, qr.fitted(q4, y1 ), tolerance = 1e-12),
+ all.equal(y4, qr.fitted(q4, y4 ), tolerance = 1e-12),
+ all.equal(y40, qr.fitted(q4, y40), tolerance = 1e-12),
+ all.equal(y04, qr.fitted(q4, y04), tolerance = 1e-12),
- all.equal(X4, qr.X(q4), tol = 1e-12)
+ all.equal(X4, qr.X(q4), tolerance = 1e-12)
)
@@ -1519,7 +1519,7 @@ ss <- smooth.spline(x, 10*sin(x))
stopifnot(length(x) == length(predict(ss,deriv=1)$x))# not yet in 1.5.0
## pweibull(large, log=T):
-stopifnot(pweibull(seq(1,50,len=1001), 2,3, log = TRUE) < 0)
+stopifnot(pweibull(seq(1,50,length.out=1001), 2,3, log = TRUE) < 0)
## part of PR 1662: fisher.test with total one
fisher.test(cbind(0, c(0,0,0,1)))
@@ -2131,7 +2131,7 @@ if(require(cluster, quietly = TRUE)) { # required package
iC2 <- !names(hcag) %in% c("labels", "call")
stopifnot(identical(hcagn[iC2], hcag[iC2]),
identical(hcagn$labels, hcn$labels),
- all.equal(hc$height, hcag$height, tol = 1e-12),
+ all.equal(hc$height, hcag$height, tolerance = 1e-12),
all(hc$merge == hcag$merge | hc$merge == hcag$merge[ ,2:1])
)
detach("package:cluster")
@@ -2543,7 +2543,7 @@ stopifnot(identical(ns(x), ns(x, df = 1)),
## predict.bs
## Consistency:
basis <- ns(women$height, df = 5)
-newX <- seq(58, 72, len = 51)
+newX <- seq(58, 72, length.out = 51)
wh <- women$height
bbase <- bs(wh)
nbase <- ns(wh)
@@ -2654,11 +2654,11 @@ ep <- 32 * Meps
for(meth in eval(formals(cor)$method)) {
cat("method = ", meth,"\n")
Cl <- cor(X, method = meth)
- stopifnot(all.equal(Cl, cor(X, method= meth, use= "complete"), tol=ep),
- all.equal(Cl, cor(X, method= meth, use= "pairwise"), tol=ep),
- all.equal(Cl, cor(X, X, method= meth), tol=ep),
- all.equal(Cl, cor(X, X, method= meth, use= "pairwise"), tol=ep),
- all.equal(Cl, cor(X, X, method= meth, use= "pairwise"), tol=ep)
+ stopifnot(all.equal(Cl, cor(X, method= meth, use= "complete"), tolerance=ep),
+ all.equal(Cl, cor(X, method= meth, use= "pairwise"), tolerance=ep),
+ all.equal(Cl, cor(X, X, method= meth), tolerance=ep),
+ all.equal(Cl, cor(X, X, method= meth, use= "pairwise"), tolerance=ep),
+ all.equal(Cl, cor(X, X, method= meth, use= "pairwise"), tolerance=ep)
)
}
## "pairwise" failed in 1.8.0
@@ -3613,7 +3613,7 @@ regexpr("[a-z]", NA)
## PR#8033: density with 'Inf' in x:
d <- density(1/0:2, kern = "rect", bw=1, from=0, to=1, n=2)
-stopifnot(all.equal(rep(1/sqrt(27), 2), d$y, tol=1e-14))
+stopifnot(all.equal(rep(1/sqrt(27), 2), d$y, tolerance=1e-14))
## failed in R 2.1.1 (since about 1.9.0)
stopifnot(all.equal(Arg(-1), pi))
@@ -3827,7 +3827,7 @@ summary(surv)
## need fuzz even for ">=" :
set.seed(1)
stopifnot(all.equal(chisq.test(cbind(1:0, c(7,16)), simulate.p = TRUE)$p.value,
- 0.3368315842, tol = 1e-6))
+ 0.3368315842, tolerance = 1e-6))
## some i686 platforms gave 0.00049975
@@ -4633,7 +4633,7 @@ stopifnot(plnorm(0, lower.tail=FALSE) == 1, plnorm(0, lower.tail=TRUE) == 0)
## supsmu with all NA values (PR#9519)
-x <- seq(0, 1, len = 100)
+x <- seq(0, 1, length.out = 100)
y <- x + NA
try(supsmu(x,y))
## segfaulted < 2.5.0
@@ -4774,12 +4774,12 @@ try({Call[] <- NULL; Call})
x <- seq(0., 3, length = 101)
nu <- -0.4
stopifnot(all.equal(besselI(x,nu, TRUE),
- exp(-x)*besselI(x,nu, FALSE), tol = 1e-13))
+ exp(-x)*besselI(x,nu, FALSE), tolerance = 1e-13))
## wrong in 2.5.0
stopifnot(all.equal(besselY(seq(0.5, 3, 0.5), nu),
c(0.309568577942, 0.568866844337, 0.626095631907,
0.544013906248, 0.366321150943, 0.141533189246),
- tol = 1e-11))
+ tolerance = 1e-11))
## wrong numbers in 2.5.0
### end of tests added in 2.5.1 ###
diff --git a/tests/reg-tests-1b.R b/tests/reg-tests-1b.R
index b125b675f48..dc68ffe04d6 100644
--- a/tests/reg-tests-1b.R
+++ b/tests/reg-tests-1b.R
@@ -197,7 +197,7 @@ stopifnot(identical(expect, gregexpr("", "abc", perl=TRUE)[[1]]))
## test of internal argument matching
-stopifnot(all.equal(round(d=2, x=pi), 3.14))
+stopifnot(all.equal(round(digits=2, x=pi), 3.14))
## used positional matching in 2.6.x
@@ -347,9 +347,13 @@ dd <- data.frame(ii = 1:10, xx = pi * -3:6)
t1 <- try(dd[,"x"])# partial match
t2 <- try(dd[,"C"])# no match
stopifnot(inherits(t1, "try-error"),
- inherits(t2, "try-error"),
- ## partial matching is "ok" for '$' {hence don't use for dataframes!}
- identical(dd$x, dd[,"xx"]))
+ inherits(t2, "try-error"))
+local({
+ old <- options(warnPartialMatchDollar=FALSE)
+ on.exit(options(old))
+ ## partial matching is "ok" for '$' {hence don't use for dataframes!}
+ stopifnot(identical(dd$x, dd[,"xx"]))
+})
## From 2.5.0 to 2.7.1, the non-match indexing gave NULL instead of error
@@ -373,7 +377,7 @@ stopifnot(rcond(cbind(1, c(3,3))) == 0)
x <- data.frame(d=Sys.Date())
stopifnot(sapply(x, is.numeric) == FALSE)
# TRUE in 2.7.1, tried to dispatch on "FUN"
-(ds <- seq(from=Sys.Date(), by=1, length=4))
+(ds <- seq(from=Sys.Date(), by=1, length.out=4))
lapply(list(d=ds), round)
# failed in 2.7.1 with 'dispatch error' since call had '...' arg
## related to calls being passed unevaluated by lapply.
@@ -471,7 +475,7 @@ sx <- sd(x)# sd() -> var()
## all three gave "missing observations in cov/cor" for a long time in the past
is.NA <- function(x) is.na(x) & !is.nan(x)
stopifnot(is.NA(v1), is.NA(v2), is.NA(sx),
- all.equal(0.5, var(x, na.rm=TRUE), tol=8*Meps)# should even be exact
+ all.equal(0.5, var(x, na.rm=TRUE), tolerance=8*Meps)# should even be exact
)
@@ -561,7 +565,7 @@ stopifnot(identical(rn, rn0))
## rounding error in windowing a time series (PR#13272)
-x <- ts(1:290, start=c(1984,10), freq=12)
+x <- ts(1:290, start=c(1984,10), frequency=12)
window(x, start=c(2008,9), end=c(2008,9), extend=FALSE)
window(x, start=c(2008,9), end=c(2008,9), extend=TRUE)
## second failed in 2.8.0
@@ -776,12 +780,12 @@ stopifnot(all.equal(bw.SJ(c(1:99, 1e6), tol = ep), 0.725, tolerance = ep))
## bw.SJ(x) failed for R <= 2.9.0 (in two ways!), when x had extreme outlier
-## anyDuplicated() with 'incomp' ...
+## anyDuplicated() with 'incomparables' ...
oo <- options(warn=2) # no warnings allowed
-stopifnot(identical(0L, anyDuplicated(c(1,NA,3,NA,5), incomp=NA)),
- identical(5L, anyDuplicated(c(1,NA,3,NA,3), incomp=NA)),
- identical(4L, anyDuplicated(c(1,NA,3,NA,3), incomp= 3)),
- identical(0L, anyDuplicated(c(1,NA,3,NA,3), incomp=c(3,NA))))
+stopifnot(identical(0L, anyDuplicated(c(1,NA,3,NA,5), incomparables=NA)),
+ identical(5L, anyDuplicated(c(1,NA,3,NA,3), incomparables=NA)),
+ identical(4L, anyDuplicated(c(1,NA,3,NA,3), incomparables= 3)),
+ identical(0L, anyDuplicated(c(1,NA,3,NA,3), incomparables=c(3,NA))))
options(oo)
## missing UNPROTECT and partly wrong in development versions of R
@@ -1073,7 +1077,7 @@ stopifnot(identical(model.frame(~V), model.frame(~V, xlev = list(V=levels(V)))))
## ks.test gave p=1 rather than p=0.9524 because abs(1/2-4/5)>3/10 was TRUE
ks5 <- ks.test(1:5, c(2.5,4.5))
-stopifnot(all.equal(20/21, ks5$p.value, tol=1e-15))
+stopifnot(all.equal(20/21, ks5$p.value, tolerance=1e-15))
## NAs in utf8ToInt and v.v.
@@ -1182,7 +1186,7 @@ stopifnot(length(newConn()) == 0)
## splinefun(., method = "monoH.FC")
-x <- 1:7 ; xx <- seq(0.9, 7.1, length=2^12)
+x <- 1:7 ; xx <- seq(0.9, 7.1, length.out=2^12)
y <- c(-12, -10, 3.5, 4.45, 4.5, 140, 142)
Smon <- splinefun(x, y, method = "monoH.FC")
stopifnot(0 <= min(Smon(xx, deriv=1)))
@@ -1198,7 +1202,7 @@ stopifnot(px[1] == "2008-04-22", length(px) == 6)
## cut( d, breaks = n) - for d of class 'Date' or 'POSIXt'
-x <- seq(as.POSIXct("2000-01-01"), by = "days", length = 20)
+x <- seq(as.POSIXct("2000-01-01"), by = "days", length.out = 20)
stopifnot(nlevels(c1 <- cut(x, breaks = 3)) == 3,
nlevels(c2 <- cut(as.POSIXlt(x), breaks = 3)) == 3,
nlevels(c3 <- cut(as.Date(x), breaks = 3)) == 3,
diff --git a/tests/reg-tests-1c.R b/tests/reg-tests-1c.R
index f94afe8ba49..576cf0efb98 100644
--- a/tests/reg-tests-1c.R
+++ b/tests/reg-tests-1c.R
@@ -234,14 +234,14 @@ unique(1:3, nmax = 1)
## besselI() (and others), now using sinpi() etc:
stopifnot(all.equal(besselI(2.125,-5+1/1024),
- 0.02679209380095711, tol= 8e-16),
- all.equal(lgamma(-12+1/1024), -13.053274367453049, tol=8e-16))
+ 0.02679209380095711, tolerance= 8e-16),
+ all.equal(lgamma(-12+1/1024), -13.053274367453049, tolerance=8e-16))
## rel.error was 1.5e-13 / 7.5e-14 in R <= 3.0.x
ss <- sinpi(2*(-10:10)-2^-12)
tt <- tanpi( (-10:10)-2^-12)
stopifnot(ss == ss[1], tt == tt[1], # as internal arithmetic must be exact here
- all.equal(ss[1], -0.00076699031874270453, tol=8e-16),
- all.equal(tt[1], -0.00076699054434309260, tol=8e-16))
+ all.equal(ss[1], -0.00076699031874270453, tolerance=8e-16),
+ all.equal(tt[1], -0.00076699054434309260, tolerance=8e-16))
## (checked via Rmpfr) The above failed during development
@@ -273,14 +273,14 @@ assert.reparsable(2+3i)
assert.reparsable(1:10)
assert.reparsable(c(NA, 12, NA, 14))
assert.reparsable(as.complex(NA))
-assert.reparsable(complex(real=Inf, i=4))
-assert.reparsable(complex(real=Inf, i=Inf))
-assert.reparsable(complex(real=Inf, i=-Inf))
-assert.reparsable(complex(real=3, i=-Inf))
-assert.reparsable(complex(real=3, i=NaN))
-assert.reparsable(complex(r=NaN, i=0))
-assert.reparsable(complex(real=NA, i=1))
-assert.reparsable(complex(real=1, i=NA))
+assert.reparsable(complex(real=Inf, imaginary=4))
+assert.reparsable(complex(real=Inf, imaginary=Inf))
+assert.reparsable(complex(real=Inf, imaginary=-Inf))
+assert.reparsable(complex(real=3, imaginary=-Inf))
+assert.reparsable(complex(real=3, imaginary=NaN))
+assert.reparsable(complex(real=NaN, imaginary=0))
+assert.reparsable(complex(real=NA, imaginary=1))
+assert.reparsable(complex(real=1, imaginary=NA))
## last 7 all failed
@@ -366,7 +366,7 @@ rX <- type.convert(ch, numerals = "no.loss", as.is=FALSE)
stopifnot(is.numeric(rr), identical(rr, rX),
all.equal(rr, 0.999267578125),
all.equal(type.convert(ch, numerals = "warn", as.is=FALSE),
- type.convert("0x1.ffap-1",numerals = "warn", as.is=FALSE), tol = 5e-15))
+ type.convert("0x1.ffap-1",numerals = "warn", as.is=FALSE), tolerance = 5e-15))
## type.convert(ch) was not numeric in R 3.1.0
##
ch <- "1234567890123456789"
@@ -484,9 +484,9 @@ set.seed(1) ; h1 <- as.hclust(mkDend(5, "S", method="single")); hc1 <- .HC.
set.seed(5) ; h5 <- as.hclust(mkDend(5, "S", method="single")); hc5 <- .HC.
set.seed(42); h3 <- as.hclust(mkDend(5, "A", method="single")); hc3 <- .HC.
## all failed (differently!) because of ties in R <= 3.2.3
-stopifnot(all.equal(h1[1:4], hc1[1:4], tol = 1e-12),
- all.equal(h5[1:4], hc5[1:4], tol = 1e-12),
- all.equal(h3[1:4], hc3[1:4], tol = 1e-12))
+stopifnot(all.equal(h1[1:4], hc1[1:4], tolerance = 1e-12),
+ all.equal(h5[1:4], hc5[1:4], tolerance = 1e-12),
+ all.equal(h3[1:4], hc3[1:4], tolerance = 1e-12))
## bw.SJ() and similar with NA,Inf values, PR#16024
@@ -575,8 +575,8 @@ stopifnot(identical(as.character(rd), c("MAC1:XXX\n","YYY\n")))
## power.t.test() failure for very large n (etc): PR#15792
(ptt <- power.t.test(delta = 1e-4, sd = .35, power = .8))
(ppt <- power.prop.test(p1 = .5, p2 = .501, sig.level=.001, power=0.90, tol=1e-8))
-stopifnot(all.equal(ptt$n, 192297000, tol = 1e-5),
- all.equal(ppt$n, 10451937, tol = 1e-7))
+stopifnot(all.equal(ptt$n, 192297000, tolerance = 1e-5),
+ all.equal(ppt$n, 10451937, tolerance = 1e-7))
## call to uniroot() did not allow n > 1e7
@@ -671,7 +671,7 @@ for(k in 1:5) {
m <- matrix(c(83,41), 5, 4,
dimnames=list(paste0("R",1:5), paste0("C",1:4)))[-5,] + 3*diag(4)
stopifnot( all.equal(eigen(m, only.values=TRUE) $ values,
- c(251, 87, 3, 3), tol=1e-14) )
+ c(251, 87, 3, 3), tolerance=1e-14) )
## failed, using symmetric=FALSE and complex because of the asymmetric dimnames()
@@ -1115,7 +1115,7 @@ for(n in 1:6) { if(n %% 10 == 0) cat(n,"\n")
control = ctrl)
cPr <- predict(cars.wt)
cPrN <- predict(cars.wt, newdata=cars)
- stopifnot(all.equal(cPr, cPrN, check.attributes = FALSE, tol=1e-14))
+ stopifnot(all.equal(cPr, cPrN, check.attributes = FALSE, tolerance=1e-14))
}
}
## gave (typically slightly) wrong predictions in R <= 3.2.2
@@ -1138,7 +1138,7 @@ stopifnot(identical( dim(aA), rev(da)),# including names(.)
fm <- lm(y ~ poly(x, 3), data=data.frame(x=1:7, y=sin(1:7)))
x <- c(1,NA,3:7)
stopifnot(all.equal(c(predict(fm, newdata=list(x = 1:3)), `4`=NA),
- predict(fm, newdata=list(x=c(1:3,NA))), tol=1e-15),
+ predict(fm, newdata=list(x=c(1:3,NA))), tolerance=1e-15),
all.equal(unclass(poly(x, degree=2, raw=TRUE)),
cbind(x, x^2), check.attributes=FALSE))
## both gave error about NA in R <= 3.2.2
@@ -1272,8 +1272,8 @@ lm9 <- lm(weight ~ group + x + I(x^2))
dc9 <- dummy.coef(lm9)
## failed in R <= 3.3.0
stopifnot( # depends on contrasts:
- all.equal(unname(coef(fm1)), unlist(dc1, use.names=FALSE)[-2], tol= 1e-14),
- all.equal(unname(coef(lm9)), unlist(dc9, use.names=FALSE)[-2], tol= 1e-14))
+ all.equal(unname(coef(fm1)), unlist(dc1, use.names=FALSE)[-2], tolerance= 1e-14),
+ all.equal(unname(coef(lm9)), unlist(dc9, use.names=FALSE)[-2], tolerance= 1e-14))
## a 'use.na=TRUE' example
dd <- data.frame(x1 = rep(letters[1:2], each=3),
x2 = rep(LETTERS[1:3], 2),
@@ -1343,8 +1343,8 @@ stopifnot(identical(rf1[1:3], c("01/01/16 00:00:00", "2016-01-22 23:47:15",
"2016-02-13 23:34:30")),
identical(rf2[1:3], c("2016-01-01 00:00:00", "01/22/16 23:47:15",
rf1[3])),
- nchar(rf1) == rep(c(17,19,19), length = length(rf1)),
- nchar(rf2) == rep(c(19,17,19), length = length(rf2)))
+ nchar(rf1) == rep(c(17,19,19), length.out = length(rf1)),
+ nchar(rf2) == rep(c(19,17,19), length.out = length(rf2)))
options(op)
## Wrong-length 'zone' or short 'x' segfaulted -- PR#16685
## Default 'format' setting sometimes failed for length(format) > 1
@@ -1479,8 +1479,8 @@ t02 <- as.POSIXct("2002-02-02 02:02")
(at <- chkPretty(t02 + 0:1, n = 5, min.n = 3, max.D=2))
xU <- as.POSIXct("2002-02-02 02:02", tz = "UTC")
x5 <- as.POSIXct("2002-02-02 02:02", tz = "EST5EDT")
-atU <- chkPretty(seq(xU, by = "30 mins", length = 2), n = 5)
-at5 <- chkPretty(seq(x5, by = "30 mins", length = 2), n = 5)
+atU <- chkPretty(seq(xU, by = "30 mins", length.out = 2), n = 5)
+at5 <- chkPretty(seq(x5, by = "30 mins", length.out = 2), n = 5)
stopifnot(length(at) >= 4,
identical(sort(names(aat <- attributes(at))), c("class", "format", "labels", "tzone")),
identical(aat$labels, time2d(59+ 0:3)),
@@ -1489,7 +1489,7 @@ stopifnot(length(at) >= 4,
identical(lat, paste("02", time2d(10* 0:4), sep=":"))
)
nns <- c(1:9, 15:17); names(nns) <- paste0("n=",nns)
-prSeq <- function(x, n, st, ...) pretty(seq(x, by = st, length = 2), n = n, ...)
+prSeq <- function(x, n, st, ...) pretty(seq(x, by = st, length.out = 2), n = n, ...)
pps <- lapply(nns, function(n)
lapply(steps, function(st) prSeq(x=t02, n=n, st=st)))
## (FIXME) relies on LC_TIME="C" (or "English",..):
@@ -1513,7 +1513,7 @@ stopifnot(identical(Ls.ok,
lapply(pps[["n=5"]], attr, "label")))
##
chkSeq <- function(st, x, n, max.D = if(n <= 4) 1 else if(n <= 10) 2 else 3, ...)
- tryCatch(chkPretty(seq(x, by = st, length = 2), n = n, max.D=max.D, ...),
+ tryCatch(chkPretty(seq(x, by = st, length.out = 2), n = n, max.D=max.D, ...),
error = conditionMessage)
prSeq.errs <- function(tt, nset, tSteps) {
stopifnot(length(tt) == 1)
diff --git a/tests/reg-tests-1d.R b/tests/reg-tests-1d.R
index 4564cd5f862..bdf5fe1a850 100644
--- a/tests/reg-tests-1d.R
+++ b/tests/reg-tests-1d.R
@@ -1009,8 +1009,8 @@ stopifnot(all.equal(as.vector(dc), c(25, 30, 16)/15))
dd <- data.frame(x1 = LETTERS[c(1,2,3, 1,2,3, 1,2,3)],
x2 = letters[c(1,2,1, 2,1,1, 1,2,1)], y = 1:9)
(sf <- summary(fit <- lm(y ~ x1*x2, data = dd))) ## last coef is NA
-stopifnot(all.equal(sigma(fit)^2, 27/2, tol = 1e-14),
- all.equal(sigma(fit), sf$sigma, tol = 1e-14))
+stopifnot(all.equal(sigma(fit)^2, 27/2, tolerance = 1e-14),
+ all.equal(sigma(fit), sf$sigma, tolerance = 1e-14))
## was too large because of wrong denom. d.f. in R <= 3.4.1
@@ -1057,8 +1057,8 @@ q.Cx <- qr(X + 0i); cfCx <- qr.coef(q.Cx, y)
e1 <- tryCid(qr.coef(q.Li, y[-4])); e1
e2 <- tryCid(qr.coef(q.LA, y[-4]))
stopifnot(exprs = {
- all.equal(cfLi, cfLA , tol = 1e-14)# 6.376e-16 (64b Lx)
- all.equal(cfLi, Re(cfCx), tol = 1e-14)# (ditto)
+ all.equal(cfLi, cfLA , tolerance = 1e-14)# 6.376e-16 (64b Lx)
+ all.equal(cfLi, Re(cfCx), tolerance = 1e-14)# (ditto)
identical(conditionMessage(e1), conditionMessage(e2))
})
## 1) cfLA & cfCx had no names in R <= 3.4.1
@@ -1450,10 +1450,10 @@ arF <- ar(prF)
stopifnot(exprs = {
all.equal(arp[c("order", "ar", "var.pred", "x.mean")],
list(order = 3, ar = c(0.6665119, 0.2800927, -0.1716641),
- var.pred = 96.69082, x.mean = 56.30702), tol = 7e-7)
- all.equal(arp$ar, arF$ar, tol = 0.14)
- all.equal(arp$var.pred, arF$var.pred, tol = 0.005)
- all.equal(arp$asy.var.coef, arF$asy.var.coef, tol = 0.09)
+ var.pred = 96.69082, x.mean = 56.30702), tolerance = 7e-7)
+ all.equal(arp$ar, arF$ar, tolerance = 0.14)
+ all.equal(arp$var.pred, arF$var.pred, tolerance = 0.005)
+ all.equal(arp$asy.var.coef, arF$asy.var.coef, tolerance = 0.09)
})
## Multivariate
set.seed(42)
@@ -1468,15 +1468,15 @@ es. <- ar( y. , aic = FALSE, order.max = 2, na.action=na.pass)
estd <- ar(unclass(y) , aic = FALSE, order.max = 2) ## Estimate VAR(2)
es.d <- ar(unclass(y.), aic = FALSE, order.max = 2, na.action=na.pass)
stopifnot(exprs = {
- all.equal(est$ar[1,,], diag(0.8, 2), tol = 0.08)# seen 0.0038
- all.equal(est[1:6], es.[1:6], tol = 5e-3)
- all.equal(estd$x.mean, es.d$x.mean, tol = 0.01) # seen 0.0023
+ all.equal(est$ar[1,,], diag(0.8, 2), tolerance = 0.08)# seen 0.0038
+ all.equal(est[1:6], es.[1:6], tolerance = 5e-3)
+ all.equal(estd$x.mean, es.d$x.mean, tolerance = 0.01) # seen 0.0023
all.equal(estd[c(1:3,5:6)],
- es.d[c(1:3,5:6)], tol = 1e-3)## seen {1,3,8}e-4
+ es.d[c(1:3,5:6)], tolerance = 1e-3)## seen {1,3,8}e-4
all.equal(lapply(estd[1:6],unname),
- lapply(est [1:6],unname), tol = 2e-12)# almost identical
+ lapply(est [1:6],unname), tolerance = 2e-12)# almost identical
all.equal(lapply(es.d[1:6],unname),
- lapply(es. [1:6],unname), tol = 1e-11)
+ lapply(es. [1:6],unname), tolerance = 1e-11)
})
## NA's in x gave an error, in R versions <= 3.4.3
@@ -1747,7 +1747,7 @@ aTab <- table(
(MT <- mantelhaen.test(aTab))
stopifnot(all.equal(
lapply(MT[1:3], unname),
- list(statistic = 9.285642, parameter = 8, p.value = 0.3187756), tol = 6e-6))
+ list(statistic = 9.285642, parameter = 8, p.value = 0.3187756), tolerance = 6e-6))
## gave integer overflow and error in R <= 3.4.x
@@ -2265,11 +2265,11 @@ stopifnot(is.integer(iMax <- .Machine$integer.max), iMax == 2^31-1,
is.integer(i3t30 <- c(-t30, 0L, t30)))
for(seq in c(seq, seq.int)) # seq() -> seq.default() to behave as seq.int() :
stopifnot(exprs = {
- seq(iM2, length=2L) == iM2:(iM2+1L) # overflow warning and NA
- seq(iM2, length=3L) == iM2:(iM2+2 ) # Error in if (from == to) ....
- seq(-t30, t30, length=3) == i3t30 # overflow warning and NA
+ seq(iM2, length.out=2L) == iM2:(iM2+1L) # overflow warning and NA
+ seq(iM2, length.out=3L) == iM2:(iM2+2 ) # Error in if (from == to) ....
+ seq(-t30, t30, length.out=3) == i3t30 # overflow warning and NA
## Next two ok for the "seq.cumsum-patch" (for "seq.double-patch", give "double"):
- identical(seq(-t30, t30, length=3L), i3t30)# Error in if(is.integer(del <- to - from)
+ identical(seq(-t30, t30, length.out=3L), i3t30)# Error in if(is.integer(del <- to - from)
identical(seq(-t30, t30, t30) , i3t30)# Error .. invalid '(to-from)/by'+NA warn.
})
## each of these gave integer overflows errors or NA's + warning in R <= 3.5.x
@@ -2279,13 +2279,13 @@ stopifnot(identical(7:10, seq.default(7L, along.with = 4:1) ))
## seq.int(*, by=, length = n) for non-integer 'from' or 'to'
stopifnot(exprs = {
- identical(seq.int(from = 1.5, by = 2, length = 3),
- s <- seq(from = 1.5, by = 2, length = 3))
+ identical(seq.int(from = 1.5, by = 2, length.out = 3),
+ s <- seq(from = 1.5, by = 2, length.out = 3))
s == c(1.5, 3.5, 5.5)
- identical(seq.int(to = -0.1, by = -2, length = 2),
- s <- seq(to = -0.1, by = -2, length = 2))
+ identical(seq.int(to = -0.1, by = -2, length.out = 2),
+ s <- seq(to = -0.1, by = -2, length.out = 2))
all.equal(s, c(1.9, -0.1))
- identical(seq.int(to = pi, by = 0, length = 1), pi)
+ identical(seq.int(to = pi, by = 0, length.out = 1), pi)
})
## returned integer sequences in all R versions <= 3.5.1
@@ -2529,7 +2529,7 @@ plot(c(-0.1, 0.2), axes=FALSE, ann=FALSE)
axis(2, at = a2) # was ugly
stopifnot(exprs = {
a2[3] == 0 # exactly
- all.equal(a2, (-2:4)/20, tol=1e-14) # closely
+ all.equal(a2, (-2:4)/20, tolerance=1e-14) # closely
})
## a2[3] was 1.38778e-17 on typical platforms in R <= 3.5.x
@@ -2676,9 +2676,9 @@ identNoE <- function(x,y, ...) identical(x,y, ignore.environment=TRUE, ...)
stopifnot(exprs = {
all.equal(fq1[keep], fqP[keep])
## quasi() failed badly "switch(vtemp, ... EXPR must be a length 1 vector" in R <= 3.6.0
- identNoE(quasi(var = mu), quasi(variance = "mu"))
- identNoE(quasi(var = mu(1-mu)), quasi(variance = "mu(1- mu)"))# both failed in R <= 3.6.0
- identNoE(quasi(var = mu^3), quasi(variance = "mu ^ 3")) # 2nd failed in R <= 3.6.0
+ identNoE(quasi(variance = mu), quasi(variance = "mu"))
+ identNoE(quasi(variance = mu(1-mu)), quasi(variance = "mu(1- mu)"))# both failed in R <= 3.6.0
+ identNoE(quasi(variance = mu^3), quasi(variance = "mu ^ 3")) # 2nd failed in R <= 3.6.0
is.character(msg <- tryCmsg(quasi(variance = "log(mu)"))) &&
grepl("variance.*log\\(mu\\).* invalid", msg) ## R <= 3.6.0: 'variance' "NA" is invalid
})
@@ -2860,7 +2860,7 @@ setMethod("oligoFn", signature(subset = "integer", value = "array"), ## Method _
setMethod("oligoFn", signature(target = "matrix", value = "array"), ## Method _10_
function(target, value) list(target=target, value=value))
##
-showMethods("oligoFn", include=TRUE) # F.Y.I.: in R 3.6.0 and earlier: contains "ANY" everywhere
+showMethods("oligoFn", includeDefs=TRUE) # F.Y.I.: in R 3.6.0 and earlier: contains "ANY" everywhere
##========= ------------
stopifnot(exprs = {
is.function(mm <- getMethod("oligoFn",
@@ -3203,8 +3203,8 @@ stopifnot(exprs = {
(ptt2 <- power.t.test(delta=2, sd = 1e-8, power=0.99, sig.level=0.01))
stopifnot(exprs = {
all.equal(0.9, power.t.test(delta=10, sd=1, n = ptt0 $ n)$power)
- all.equal(ptt1$n, 1.00428, tol = 1e-5)
- all.equal(ptt2$n, 1.1215733, tol = 1e-5)
+ all.equal(ptt1$n, 1.00428, tolerance = 1e-5)
+ all.equal(ptt2$n, 1.1215733, tolerance = 1e-5)
})
## when uniroot() was trying n < 1, the code failed previously (in 2nd and 3rd case)
@@ -3490,7 +3490,7 @@ set.seed(7); tt <- ts(rnorm(60), frequency=12)
dt2 <- diff(tt, differences = 2) # Error in .cbind.ts(..): not all series have the same phase
tsD <- ts(1:49, start=as.Date("2019-12-12"), frequency=12)
stopifnot(exprs = {
- all.equal(timeO, ttt - 1981, tol = 1e-8)
+ all.equal(timeO, ttt - 1981, tolerance = 1e-8)
inherits(ttt, "ts")
inherits(dt2, "ts")
length(dt2) == length(tt) - 2L
@@ -3551,7 +3551,7 @@ rnd.x <- vapply(dd+1L, function(k) round(x55[k], dd[k]), 1.1)
noquote(formatC(cbind(x55, dd, rnd.x), w=1, digits=15))
signif (rnd.x - x55, 3) # look at .. but don't test (yet)
stopifnot(exprs = {
- all.equal(abs(rnd.x - x55), 5 * 10^-(dd+1), tol = 1e-11) # see diff. of 6e-13
+ all.equal(abs(rnd.x - x55), 5 * 10^-(dd+1), tolerance = 1e-11) # see diff. of 6e-13
})
## more than half of the above were rounded *down* in R <= 3.6.x
## Some "wrong" test cases from CRAN packages (partly relying on wrong R <= 3.6.x behavior)
@@ -3580,8 +3580,8 @@ for(digi in c(0:10, 500L, 1000L, 100000L, .Machine$integer.max))
identical(i+round(1/4, digi), round(i+1/4, digi)))
x <- 7e-304; rx <- round(x, digits=307:322); xx <- rep(x, length(rx))
print(cbind(rx), digits=16) # not really what ideally round() should do; but "ok"
- all.equal(rx, xx, tol = 0)# show "average relative difference" ("5.6856 e -16")
-stopifnot(all.equal(rx, xx, tol = 1e-4)) # tol may change in future
+ all.equal(rx, xx, tolerance = 0)# show "average relative difference" ("5.6856 e -16")
+stopifnot(all.equal(rx, xx, tolerance = 1e-4)) # tol may change in future
## the round(i, *) failed, for ~ 2 days, in R-devel
e <- 5.555555555555555555555e-308
(e10 <- e * 1e298) # 5.555556e-10 -- much less extreme, for comparison
@@ -3598,9 +3598,9 @@ stopifnot(exprs = {
## the regularity of signif()'s result is amazing:
is.integer(d <- ds[iSub] - 1L)
all.equal(log10(abs(1 - diff(unname(s.e))[iSub] * 1e308*10^d / 4)),
- d - 16, tol = 0.08) # tol: seen 0.0294 / 0.02988 (Win 32b)
+ d - 16, tolerance = 0.08) # tol: seen 0.0294 / 0.02988 (Win 32b)
all.equal(r.e * 1e298, r.e10,
- check.attributes = FALSE, countEQ=TRUE, tol=1e-14)
+ check.attributes = FALSE, countEQ=TRUE, tolerance=1e-14)
})
## was not true for digits = 309, 310 in R <= 3.6.x
##
@@ -3683,7 +3683,7 @@ set.seed(6860); N <- rhyper(1, n,n,n)
x <- 1.99e9; Nhi <- rhyper(256, x,x,x)
stopifnot(#identical(N, 999994112L), # (wrong) implementation detail
is.integer(Nhi),
- all.equal(mean(Nhi), x/2, tol = 6e-6)) # ==> also: no NAs
+ all.equal(mean(Nhi), x/2, tolerance = 6e-6)) # ==> also: no NAs
## NA's and warnings, incl "SHOULD NOT HAPPEN!" in R <= 3.6.2
@@ -3969,6 +3969,7 @@ rm(p)
## make sure there is no aliasing in assignments with partial matching
+old <- options(warnPartialMatchDollar=FALSE)
v <- list(misc = c(1))
v$mi[[1]] <- 2
stopifnot(v$misc == 1)
@@ -3977,6 +3978,7 @@ v <- list(misc = c(1))
eval(compiler::compile(quote(v$mi[[1]] <- 2)))
stopifnot(v$misc == 1)
rm(v)
+options(old)
## defensive reference counts needed; missing in R 4.0.0
@@ -5061,8 +5063,8 @@ relEdiff <- function(L) vapply(lapply(L, diff), relE, 1.23)
by <- 1e307
stopifnot(exprs = {
## C = R : seq.int() <==> seq.default :
- all.equal(Lby , LbyR, tol=1e-15)
- all.equal(Llen, LleR, tol=1e-15)
+ all.equal(Lby , LbyR, tolerance=1e-15)
+ all.equal(Llen, LleR, tolerance=1e-15)
## by :
abs(diff(s <- seq.int(-1.5e308, 1e308, by=by))/by - 1) < 1e-14
is.matrix(rng <- vapply(Lby, range, numeric(2)))
@@ -5087,9 +5089,9 @@ stopifnot(identical(aP, list(axp = c(Inf, Inf), n = 1L)))
## all.equal(x,y) when 'x' or 'y' are close to overflowing to +/- Inf:
set.seed(7); x <- c(outer(pi^(-4*(-3:4)), 1:7)); y <- x*(1+rt(x, 3)/1e9)
-stopifnot(all.equal(x,y, tol=8e-8))
+stopifnot(all.equal(x,y, tolerance=8e-8))
for(f in c(10^c(-308:-300, 300:308), rlnorm(2^9, 3, 4)))
- stopifnot(all.equal(f*x, f*y, tol=8e-8))
+ stopifnot(all.equal(f*x, f*y, tolerance=8e-8))
## failed for 1e301 (and larger) in R <= 4.1.0
@@ -5250,7 +5252,7 @@ for(xaxs in c("r","i")) {
cat(sprintf('xaxs = "%s"\n==========\n', xaxs)); par(xaxs = xaxs)
for(e2Min in c(-1074, -1070, -1060, -1050)) {
cat("\ne2Min=",e2Min,":\n------------\n")
- sL <- 2^seq(e2Min, mE, length=128)
+ sL <- 2^seq(e2Min, mE, length.out=128)
mplot(sL, sin(sL))# was Error plot.window(): infinite axis extents [GEPretty(-7.19e306,inf,5)]
print(puaxN <- parUAx())
mplot(sL, sin(sL), log="x")
@@ -5265,7 +5267,7 @@ for(xaxs in c("r","i")) {
xaxp=c(0, rep(1.5e+308,2))),
"i" = cbind(usr= 2^c(e2Min, mE, mE),
xaxp=c(0, rep(1.5e+308,2))))[[xaxs]])
- all.equal(10^cumsum(c(-307, rep(123, 5))), axu, tol=1e-12)# 3.4e-14 {Win64}
+ all.equal(10^cumsum(c(-307, rep(123, 5))), axu, tolerance=1e-12)# 3.4e-14 {Win64}
all.equal(puax[1:2,"xaxp"], c(1e-307, 1e308))
{ cat("1 - u / ... : ")
abs(print(1 - u / c(c(r=-1022, i=e2Min)[[xaxs]], mE) * log2(10))) < 5e-5 }
@@ -5291,7 +5293,7 @@ a <- mplot(LL, 0:1) # (no warning)
stopifnot(exprs = {
all.equal(a$a1, axTicks(1))
all.equal(a$a1, (-3:3)*5e307)
- all.equal(LL, puax[1:2,"usr"], tol=1e-10)
+ all.equal(LL, puax[1:2,"usr"], tolerance=1e-10)
puax[3,] == Inf
})
## These are even a bit better (no partial clipping) {gave error in R <= 4.1.0}:
@@ -5317,9 +5319,9 @@ for(yMin in c(0, 5e-324, 1e-318, 1e-312, 1e-306)) {
atx <- axisTicks(par("usr")[3:4], log=TRUE, axp=par("yaxp")) # ditto
if(yMin > 0) {
print(axT <- axTicks(2)) # 1e-307 1e-244 1e-181 1e-118 1e-55 1e+08
- stopifnot(all.equal(axT, atx, tol = 1e-15))
+ stopifnot(all.equal(axT, atx, tolerance = 1e-15))
}
- stopifnot(all.equal(atx, 10^cumsum(c(-307, rep(63, 5))), tol=1e-13)) # Win64: 3.3e-14
+ stopifnot(all.equal(atx, 10^cumsum(c(-307, rep(63, 5))), tolerance=1e-13)) # Win64: 3.3e-14
}
## the *first* plot looked ugly in R <= 4.1.0 and failed for a few days in R-devel
proc.time() - .pt; .pt <- proc.time()
@@ -5661,32 +5663,32 @@ i <- c(8:5, 3:4, 2:1, 9:10)# 10:1 is too special (a permutation which is its own
ss <- sspline_(x=x, y=y )
ss.u <- sspline_(x=x[i], y=y[i])
## was "Component “cv.crit”: Mean relative difference: 3099.013" :
- all.equal(noC(ss), noC(ss.u), tol=0) # TRUE (!)
-stopifnot(all.equal(noC(ss), noC(ss.u), tol=1e-14)) ## now fixed
+ all.equal(noC(ss), noC(ss.u), tolerance=0) # TRUE (!)
+stopifnot(all.equal(noC(ss), noC(ss.u), tolerance=1e-14)) ## now fixed
## The same with __weights__ some of which exactly 0
table(w <- pmax(0, abs(16*e)-1)) # 2 x 0
ssw <- sspline_(x=x, y=y, w=w )
ssw.u <- sspline_(x=x[i], y=y[i], w=w[i])
- all.equal(noC(ssw), noC(ssw.u), tol=0) # TRUE (!)
-stopifnot(all.equal(noC(ssw), noC(ssw.u), tol=1e-14)) ## now fixed
+ all.equal(noC(ssw), noC(ssw.u), tolerance=0) # TRUE (!)
+stopifnot(all.equal(noC(ssw), noC(ssw.u), tolerance=1e-14)) ## now fixed
## was "Component “cv.crit”: Mean relative difference: 60.05904"
## Now with GCV instead of CV ====================
## 1) no weights
ssg <- sspline_(x=x, y=y , cv=FALSE)
ssg.u <- sspline_(x=x[i], y=y[i], cv=FALSE)
- all.equal(noC(ssg), noC(ssg.u), tol=0) # TRUE (!)
-stopifnot(all.equal(noC(ssg), noC(ssg.u), tol=1e-14)) ## now fixed
+ all.equal(noC(ssg), noC(ssg.u), tolerance=0) # TRUE (!)
+stopifnot(all.equal(noC(ssg), noC(ssg.u), tolerance=1e-14)) ## now fixed
## 2) with weights
sswg <- sspline_(x=x, y=y, w=w , cv=FALSE)
sswg.u <- sspline_(x=x[i], y=y[i], w=w[i], cv=FALSE)
- all.equal(noC(sswg), noC(sswg.u), tol=0) # TRUE (!)
-stopifnot(all.equal(noC(sswg), noC(sswg.u), tol=1e-14)) ## now fixed
+ all.equal(noC(sswg), noC(sswg.u), tolerance=0) # TRUE (!)
+stopifnot(all.equal(noC(sswg), noC(sswg.u), tolerance=1e-14)) ## now fixed
## the same with 'x' that are almost identical so will be collapsed (and weighted):
x. <- c(1:2, (1- 1e-7)*4, 4:6, (1- 1e-9)*8, 8:10)
ss3w <- getVaW(sspline_(x=x., y=y , w=w ))
ss3w.u <- getVaW(sspline_(x=x.[i], y=y[i], w=w[i]))
- all.equal(noC(ss3w), noC(ss3w.u), tol=0) # TRUE (also previously)
-stopifnot(all.equal(noC(ss3w), noC(ss3w.u), tol=1e-14))
+ all.equal(noC(ss3w), noC(ss3w.u), tolerance=0) # TRUE (also previously)
+stopifnot(all.equal(noC(ss3w), noC(ss3w.u), tolerance=1e-14))
## was "Component “cv.crit”: Mean relative difference: 60.05904"
if(englishMsgs)
stopifnot(attr(ss3w,"warning") ==
@@ -5694,8 +5696,8 @@ if(englishMsgs)
## now with GCV :
ss3gw <- sspline_(x=x., y=y , w=w , cv=FALSE)
ss3gw.u <- sspline_(x=x.[i], y=y[i], w=w[i], cv=FALSE)
- all.equal(noC(ss3gw), noC(ss3gw.u), tol=0) # TRUE (also previously)
-stopifnot(all.equal(noC(ss3gw), noC(ss3gw.u), tol=1e-14))
+ all.equal(noC(ss3gw), noC(ss3gw.u), tolerance=0) # TRUE (also previously)
+stopifnot(all.equal(noC(ss3gw), noC(ss3gw.u), tolerance=1e-14))
## non-ordered 'x' gave wrong $cv.crit in the nx=n case in R <= 4.1.2
diff --git a/tests/reg-tests-1e.R b/tests/reg-tests-1e.R
index 8723e0a8faa..0a475f5b17c 100644
--- a/tests/reg-tests-1e.R
+++ b/tests/reg-tests-1e.R
@@ -238,12 +238,12 @@ set.seed(123)
head(d. <- cbind(d., y = y0 + rnorm(20)))
fm1 <- lm(y ~ x + f + poly(D,3), data = d.)
fm1r <- lm(y ~ x + f + poly(D,2, raw=TRUE), data = d.)
-newd <- data.frame(x = seq(1/3, 1/2, length=5), f = gl(4,5)[5:9], D = .Date(17000 + 51:55))
+newd <- data.frame(x = seq(1/3, 1/2, length.out=5), f = gl(4,5)[5:9], D = .Date(17000 + 51:55))
yhat <- unname(predict(fm1, newdata = newd))
yh.r <- unname(predict(fm1r, newdata = newd))
cbind(yhat, yh.r)
-stopifnot(all.equal(yhat, c(96.8869, 92.3821, 81.9967, 71.2076, 60.0147), tol=1e-6), # 3e-7
- all.equal(yh.r, c(97.7595, 93.0218, 82.3533, 71.2806, 59.8036), tol=1e-6))
+stopifnot(all.equal(yhat, c(96.8869, 92.3821, 81.9967, 71.2076, 60.0147), tolerance=1e-6), # 3e-7
+ all.equal(yh.r, c(97.7595, 93.0218, 82.3533, 71.2806, 59.8036), tolerance=1e-6))
## poly(D, 3) failed since R 4.1.x, poly(.., raw=TRUE) in all earlier R versions
@@ -302,7 +302,7 @@ stopifnot(identical(myexpand(fit2)$y, 4:10)) # failed in R <= 4.2.1 with
## time() returning numbers very slightly on the wrong side of an integer
-x <- ts(2:252, start = c(2002, 2), freq = 12)
+x <- ts(2:252, start = c(2002, 2), frequency = 12)
true.year <- rep(2002:2022, each = 12)[-1]
stopifnot(floor(as.numeric(time(x))) == true.year)
## seen 10 differences in R <= 4.2.x
@@ -478,10 +478,10 @@ tools::assertWarning(print(predict(mod2, newdata=nd, rankdeficient = "warnif")))
predict(mod2, newdata=nd, rankdeficient = "NA")
nm5 <- as.character(1:5)
stopifnot(exprs = {
- all.equal(setNames(rep(0, 5), nm5), predict(mod2), tol=1e-13) # pred: 1.776e-15
+ all.equal(setNames(rep(0, 5), nm5), predict(mod2), tolerance=1e-13) # pred: 1.776e-15
is.numeric(p2 <- predict(mod2, newdata = data.frame(y=rep(1,5)))) # no warning, no NA:
identical(p2, predict(mod2, newdata = data.frame(y=rep(1,5)), rankdeficient="NA"))
- all.equal(p2, setNames(rep(1, 5), nm5), tol=1e-13)# off.= x+2y + x-y = 2x+y =4+1=5; 5+ = 1
+ all.equal(p2, setNames(rep(1, 5), nm5), tolerance=1e-13)# off.= x+2y + x-y = 2x+y =4+1=5; 5+ = 1
})
## fine, using model.offset() now
@@ -809,7 +809,7 @@ assertErrV(get("x4", .GlobalEnv, mode = "integer"))
c(5, 7, 9)))
## 1) kappa(z=, norm="1", method="direct")` ignores lower triangle of z
km1d <- kappa(m, norm = "1", method = "direct")
-all.equal(km1d, 7.6, tol=0) # 1.17e-16 {was wrongly 11.907 in R <= 4.3.1}
+all.equal(km1d, 7.6, tolerance=0) # 1.17e-16 {was wrongly 11.907 in R <= 4.3.1}
## 2) kappa(z, norm="2", LINPACK=TRUE) silently returns estimate of the *1*-norm cond.nr.
(km1 <- kappa(m, norm = "1")) # 4.651847 {unchanged}
tools::assertWarning(verbose=TRUE, # now *warns*
@@ -824,25 +824,25 @@ km2La
## 5) rcond(x=, triangular=TRUE) silently ignores the lower (rather than upper)
## triangle of `x`, contradicting `help("rcond")`.
## ==> Fixing help page; but *also* adding uplo = "U" argument
-all.equal(4/65, (rcTm <- rcond(m, triangular=TRUE)), tol = 0) # {always}
-all.equal(9/182,(rcTL <- rcond(m, triangular=TRUE, uplo="L")), tol=0) # 1.4e-16
+all.equal(4/65, (rcTm <- rcond(m, triangular=TRUE)), tolerance = 0) # {always}
+all.equal(9/182,(rcTL <- rcond(m, triangular=TRUE, uplo="L")), tolerance=0) # 1.4e-16
##
## New features, can use norm "M" or "F" for exact=TRUE via norm(*, type=)
(kM <- kappa(m, norm="M", exact = TRUE)) # 2.25 "M" is allowed type for norm()
(kF <- kappa(m, norm="F", exact = TRUE)) # 6.261675 "F" is allowed type for norm()
-all.equal(6.261675485, kF, tol=0) # 2.81e-11
+all.equal(6.261675485, kF, tolerance=0) # 2.81e-11
stopifnot(exprs = {
all.equal(4.6518474224, km1)
km1 == kappa(m) # same computation
km1 == kappa(qr.R(qr(m))) # "
- all.equal(km1d, 7.6, tol = 1e-15)
+ all.equal(km1d, 7.6, tolerance = 1e-15)
km1d == kappa(m, method = "direct") # identical computation {always ok}
identical(km2L, km1)
all.equal(km2La, 5.228678219)
all.equal(kqrm2, km1) # even identical
rcTm == rcond(m, triangular=TRUE, uplo = "U") # uplo="U" was default always
- all.equal(4/65, rcTm, tol = 1e-14)
- all.equal(9/182, rcTL, tol = 1e-13)
+ all.equal(4/65, rcTm, tolerance = 1e-14)
+ all.equal(9/182, rcTL, tolerance = 1e-13)
1/rcond(m) == km1d # same underlying Lapack code
## 6) kappa(z=) throws bad errors due to 1:0 in kappa.qr():
kappa(m00 <- matrix(0, 0L, 0L)) == 0
@@ -857,7 +857,7 @@ stopifnot(exprs = {
rcond(t(m20)) == Inf # (ditto)
## norm "M" or "F" for exact=TRUE:
2.25 == kM # exactly
- all.equal(6.261675485, kF, tol=1e-9)
+ all.equal(6.261675485, kF, tolerance=1e-9)
})
## -- Complex matrices --------------------------------------------------
(zm <- m + 1i*c(1,-(1:2))*(m/4))
@@ -870,8 +870,8 @@ tools::assertWarning(verbose=TRUE, # *same* warning (1-norm instead of 2-)
kz2La
## 4) kappa.qr(z) implicitly assumes nrow(z$qr) >= ncol(z$qr) ..
(kzqr2 <- kappa(qr(cbind(zm, zm + 1)))) # gave Error .. matrix should be square
-all.equal(0.058131632, (rcTm <- rcond(zm, triangular=TRUE )), tol=0) # 3.178e-9
-all.equal(0.047891278, (rcTL <- rcond(zm, triangular=TRUE, uplo="L")), tol=0) # 4.191e-9
+all.equal(0.058131632, (rcTm <- rcond(zm, triangular=TRUE )), tolerance=0) # 3.178e-9
+all.equal(0.047891278, (rcTL <- rcond(zm, triangular=TRUE, uplo="L")), tolerance=0) # 4.191e-9
## New: can use norm "M" or "F" for exact=TRUE:
(kz <- kappa(zm, norm="M", exact = TRUE)) # 2.440468
(kF <- kappa(zm, norm="F", exact = TRUE)) # 6.448678
@@ -881,8 +881,8 @@ stopifnot(exprs = {
all.equal(0.058131632, rcTm) # "
all.equal(0.047891278, rcTL)
all.equal(6.82135883, kzqr2)
- all.equal(2.44046765, kz, tol = 1e-9) # 1.8844e-10
- all.equal(6.44867822, kF, tol = 4e-9) # 4.4193e-10
+ all.equal(2.44046765, kz, tolerance = 1e-9) # 1.8844e-10
+ all.equal(6.44867822, kF, tolerance = 4e-9) # 4.4193e-10
})
## norm() and kappa(., exact=TRUE, ..) now work ok in many more cases
@@ -990,7 +990,7 @@ stopifnot(roundtrip(r"(\item text)"))
## PR#18618: match() incorrect with POSIXct || POSIXlt || fractional sec
-(dCT <- seq(as.POSIXct("2010-10-31", tz = "Europe/Berlin"), by = "hour", length = 5))
+(dCT <- seq(as.POSIXct("2010-10-31", tz = "Europe/Berlin"), by = "hour", length.out = 5))
(dd <- diff(dCT))
chd <- as.character(dCT)
vdt <- as.vector (dCT)
@@ -1122,7 +1122,7 @@ stopifnot(identical(cov2cor(m00), m00))
op <- options(warn=1)
m <- capture.output(r <- cov2cor(D_1), type = "message")
matrix(rep_len(c(1, rep(NaN,3)),3*3), 3) -> r0
-stopifnot(all.equal(r, r0, tol = 0, check.attributes = FALSE),# always ok
+stopifnot(all.equal(r, r0, tolerance = 0, check.attributes = FALSE),# always ok
length(m) == 2, grepl("^ *diag.V. ", m[2]))
options(op) # revert
## cov2cor() gave 2 warnings on 3 lines, the 2nd one inaccurate in R <= 4.3.2
diff --git a/tests/reg-tests-2.R b/tests/reg-tests-2.R
index 248964deeb5..257b9dcce5a 100644
--- a/tests/reg-tests-2.R
+++ b/tests/reg-tests-2.R
@@ -11,7 +11,7 @@ options(useFancyQuotes=FALSE)
## abbreviate
for(m in 1:5) {
cat("\n",m,":\n")
- print(as.vector(abbreviate(state.name, minl=m)))
+ print(as.vector(abbreviate(state.name, minlength=m)))
}
## apply
@@ -43,19 +43,19 @@ x0 <- 2^(-20:10)
plot(x0,x0, log='xy', ylab="", ylim=c(.1,1e60),type='n',
main = "Bessel Functions -Y_nu(x) near 0\n log - log scale")
for(nu in sort(c(nus,nus+.5))) lines(x0, -besselY(x0,nu=nu), col = nu+2)
-legend(3,1e50, leg=paste("nu=", paste(nus,nus+.5, sep=",")), col=nus+2, lwd=1)
+legend(3,1e50, legend =paste("nu=", paste(nus,nus+.5, sep=",")), col=nus+2, lwd=1)
x <- seq(3,500);yl <- c(-.3, .2)
plot(x,x, ylim = yl, ylab="",type='n', main = "Bessel Functions Y_nu(x)")
for(nu in nus){xx <- x[x > .6*nu]; lines(xx,besselY(xx,nu=nu), col = nu+2)}
-legend(300,-.08, leg=paste("nu=",nus), col = nus+2, lwd=1)
+legend(300,-.08, legend =paste("nu=",nus), col = nus+2, lwd=1)
x <- seq(10,50000,by=10);yl <- c(-.1, .1)
plot(x,x, ylim = yl, ylab="",type='n', main = "Bessel Functions Y_nu(x)")
for(nu in nus){xx <- x[x > .6*nu]; lines(xx,besselY(xx,nu=nu), col = nu+2)}
-summary(bY <- besselY(2,nu = nu <- seq(0,100,len=501)))
+summary(bY <- besselY(2,nu = nu <- seq(0,100,length.out=501)))
which(bY >= 0)
-summary(bY <- besselY(2,nu = nu <- seq(3,300,len=51)))
+summary(bY <- besselY(2,nu = nu <- seq(3,300,length.out=51)))
summary(bI <- besselI(x = x <- 10:700, 1))
## end of moved from Bessel.Rd
@@ -98,14 +98,14 @@ for(i in c(1:5,10,15,16)) cat(i,":\t",format(pi,digits=i),"\n")
p <- c(47,13,2,.1,.023,.0045, 1e-100)/1000
format.pval(p)
format.pval(p / 0.9)
-format.pval(p / 0.9, dig=3)
+format.pval(p / 0.9, digits=3)
## end of moved from format.Rd
## is.finite
x <- c(100,-1e-13,Inf,-Inf, NaN, pi, NA)
x # 1.000000 -3.000000 Inf -Inf NA 3.141593 NA
-names(x) <- formatC(x, dig=3)
+names(x) <- formatC(x, digits=3)
is.finite(x)
##- 100 -1e-13 Inf -Inf NaN 3.14 NA
##- T T . . . T .
@@ -155,20 +155,20 @@ kronecker(fred, bill, make.dimnames = TRUE)
# dimnames are hard work: let's test them thoroughly
dimnames(bill) <- NULL
-kronecker(fred, bill, make=TRUE)
-kronecker(bill, fred, make=TRUE)
+kronecker(fred, bill, make.dimnames=TRUE)
+kronecker(bill, fred, make.dimnames=TRUE)
dim(bill) <- c(2, 2, 1)
dimnames(bill) <- list(c("happy", "sad"), NULL, "")
-kronecker(fred, bill, make=TRUE)
+kronecker(fred, bill, make.dimnames=TRUE)
bill <- array(1:24, c(3, 4, 2))
dimnames(bill) <- list(NULL, NULL, c("happy", "sad"))
-kronecker(bill, fred, make=TRUE)
-kronecker(fred, bill, make=TRUE)
+kronecker(bill, fred, make.dimnames=TRUE)
+kronecker(fred, bill, make.dimnames=TRUE)
fred <- outer(fred, c("frequentist"=4, "bayesian"=4000))
-kronecker(fred, bill, make=TRUE)
+kronecker(fred, bill, make.dimnames=TRUE)
## end of moved from kronecker.Rd
## merge
@@ -393,7 +393,7 @@ kernel("daniell", m=c(3,5,7))
## fixed by patch from Adrian Trapletti 2001-03-08
## Start new year (i.e. line) at Jan:
-(tt <- ts(1:10, start = c(1920,7), end = c(1921,4), freq = 12))
+(tt <- ts(1:10, start = c(1920,7), end = c(1921,4), frequency = 12))
cbind(tt, tt + 1)
@@ -446,9 +446,9 @@ f <- function(x) UseMethod("f")
f.foo <- function(x) { on.exit(e <<- g()); NULL }
f.bar <- function(x) { on.exit(e <<- g()); return(NULL) }
f(structure(1,class = "foo"))
-ls(env = e)# only "x", i.e. *not* the GlobalEnv
+ls(envir = e)# only "x", i.e. *not* the GlobalEnv
f(structure(1,class = "bar"))
-stopifnot("x" == ls(env = e))# as above; wrongly was .GlobalEnv in R 1.3.x
+stopifnot("x" == ls(envir = e))# as above; wrongly was .GlobalEnv in R 1.3.x
## some tests that R supports logical variables in formulae
@@ -648,8 +648,8 @@ format(x, justify = "none")
## print.ts problems ggrothendieck@yifan.net on R-help, 2002-04-01
x <- 1:20
-tt1 <- ts(x,start=c(1960,2), freq=12)
-tt2 <- ts(10+x,start=c(1960,2), freq=12)
+tt1 <- ts(x,start=c(1960,2), frequency=12)
+tt2 <- ts(10+x,start=c(1960,2), frequency=12)
cbind(tt1, tt2)
## 1.4.1 had `Jan 1961' as `NA 1961'
## ...and 1.9.1 had it as `Jan 1960'!!
@@ -708,7 +708,7 @@ options(oldcon)
(qq <- sapply(0:5, function(k) {
x <- c(rep(-Inf,k+1), 0:k, rep(Inf, k))
sapply(1:9, function(typ)
- quantile(x, pr=(2:10)/10, type=typ))
+ quantile(x, probs=(2:10)/10, type=typ))
}, simplify="array"))
x <- c(-Inf, -Inf, Inf, Inf)
median(x)
@@ -813,12 +813,12 @@ par(mfrow = c(3,3))
for(j.fac in 1e-12* c(10, 1, .7, .3, .2, .1, .05, .03, .01)) {
## ====
#set.seed(101) # or don't
- x <- pi + jitter(numeric(101), f = j.fac)
- rrtxt <- paste("rel.range =", formatC(relrange(x), dig = 4),"* EPS")
+ x <- pi + jitter(numeric(101), factor = j.fac)
+ rrtxt <- paste("rel.range =", formatC(relrange(x), digits = 4),"* EPS")
cat("j.f = ", format(j.fac)," ; ", rrtxt,"\n",sep="")
plot(x, type = "l", main = rrtxt)
- cat("par(\"usr\")[3:4]:", formatC(par("usr")[3:4], wid = 10),"\n",
- "par(\"yaxp\") : ", formatC(par("yaxp"), wid = 10),"\n\n", sep="")
+ cat("par(\"usr\")[3:4]:", formatC(par("usr")[3:4], width = 10),"\n",
+ "par(\"yaxp\") : ", formatC(par("yaxp"), width = 10),"\n\n", sep="")
}
par(mfrow = c(1,1))
## The warnings from inside GScale() will differ in their relrange() ...
@@ -883,9 +883,9 @@ x2 <- x1 <- 1:10
x3 <- 0.1*(1:10)^2
y <- x1 + rnorm(10)
(fit <- lm(y ~ x1 + x2 + x3))
-summary(fit, cor = TRUE)
+summary(fit, correlation = TRUE)
(fit <- glm(y ~ x1 + x2 + x3))
-summary(fit, cor = TRUE)
+summary(fit, correlation = TRUE)
## omitted silently in summary.glm < 1.8.0
@@ -940,8 +940,8 @@ x <- rep(0, 10)
summary(fit)
anova(fit)
predict(fit)
-predict(fit, data.frame(x=x), se=TRUE)
-predict(fit, type="terms", se=TRUE)
+predict(fit, data.frame(x=x), se.fit=TRUE)
+predict(fit, type="terms", se.fit=TRUE)
variable.names(fit) #should be empty
model.matrix(fit)
@@ -950,12 +950,12 @@ summary(fit)
anova(fit)
predict(fit)
tools::assertWarning(
- predict(fit, data.frame(x=x), se=TRUE) -> p0
+ predict(fit, data.frame(x=x), se.fit=TRUE) -> p0
)
p0
if(FALSE)## not yet:
stopifnot(identical(p0$fit, predict(fit, data.frame(x=x), rankdeficient = "NA")))
-predict(fit, type="terms", se=TRUE)
+predict(fit, type="terms", se.fit=TRUE)
variable.names(fit) #should be empty
model.matrix(fit)
@@ -963,20 +963,20 @@ model.matrix(fit)
summary(fit)
anova(fit)
predict(fit)
-predict(fit, data.frame(x=x), se=TRUE)
-predict(fit, type="terms", se=TRUE)
+predict(fit, data.frame(x=x), se.fit=TRUE)
+predict(fit, type="terms", se.fit=TRUE)
(fit <- glm(y ~ x + 0))
summary(fit)
anova(fit)
predict(fit)
tools::assertWarning(
- predict(fit, data.frame(x=x), se=TRUE) -> p0
+ predict(fit, data.frame(x=x), se.fit=TRUE) -> p0
)
p0
if(FALSE)## not yet:
stopifnot(identical(p0$fit, predict(fit, data.frame(x=x), rankdeficient = "NA")))
-predict(fit, type="terms", se=TRUE)
+predict(fit, type="terms", se.fit=TRUE)
## Lots of problems in 1.7.x
@@ -1147,7 +1147,7 @@ matrix(list(), 1, 2)
## S compatibility change in 1.9.0
-rep(1:2, each=3, length=12)
+rep(1:2, each=3, length.out=12)
## used to pad with NAs.
@@ -1358,7 +1358,7 @@ write.table(data.frame(x = 0.5+1:4, y = 1:4 + 1.5i), file = "", dec=",")
## used '.' not ',' in 2.0.0
## splinefun() value test
-(x <- seq(0,6, length=25))
+(x <- seq(0,6, length.out=25))
mx <- sapply(c("fmm", "nat", "per"),
function(m) splinefun(1:5, c(1,2,4,3,1), method = m)(x))
cbind(x,mx)
@@ -1367,9 +1367,9 @@ cbind(x,mx)
## infinite loop in read.fwf (PR#7350)
cat(file="test.txt", sep = "\n", "# comment 1", "1234567 # comment 2",
"1 234567 # comment 3", "12345 67 # comment 4", "# comment 5")
-read.fwf("test.txt", width=c(2,2,3), skip=1, n=4) # looped
-read.fwf("test.txt", width=c(2,2,3), skip=1) # 1 line short
-read.fwf("test.txt", width=c(2,2,3), skip=0)
+read.fwf("test.txt", widths=c(2,2,3), skip=1, n=4) # looped
+read.fwf("test.txt", widths=c(2,2,3), skip=1) # 1 line short
+read.fwf("test.txt", widths=c(2,2,3), skip=0)
unlink("test.txt")
##
@@ -1443,7 +1443,7 @@ x2 <- data.frame(a=1:2, b=I(list(a=1, b=2)))
x2
write.table(x2)
-x3 <- seq(as.Date("2005-01-01"), len=6, by="day")
+x3 <- seq(as.Date("2005-01-01"), length.out=6, by="day")
x4 <- data.frame(x=1:6, y=x3)
dim(x3) <- c(2,3)
x3
@@ -1454,9 +1454,9 @@ write.table(x4) # preserves class, does not quote
## Problem with earlier regexp code spotted by KH
-grep("(.*s){2}", "Arkansas", v = TRUE)
-grep("(.*s){3}", "Arkansas", v = TRUE)
-grep("(.*s){3}", state.name, v = TRUE)
+grep("(.*s){2}", "Arkansas", value = TRUE)
+grep("(.*s){3}", "Arkansas", value = TRUE)
+grep("(.*s){3}", state.name, value = TRUE)
## Thought Arkansas had 3 s's.
@@ -1710,9 +1710,9 @@ str(dend2$upper)
## formatC on Windows (PR#8337)
xx <- pi * 10^(-5:4)
-cbind(formatC(xx, wid = 9))
-cbind(formatC(xx, wid = 9, flag = "-"))
-cbind(formatC(xx, wid = 9, flag = "0"))
+cbind(formatC(xx, width = 9))
+cbind(formatC(xx, width = 9, flag = "-"))
+cbind(formatC(xx, width = 9, flag = "0"))
## extra space on 2.2.1
@@ -1743,10 +1743,10 @@ update.formula (Reaction ~ Days + (Days | Subject), . ~ . + I(Days^2))
## PR#8528: errors in the post-2.1.0 pgamma
-pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log=TRUE)
-pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log=TRUE, lower=FALSE)
+pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log.p=TRUE)
+pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log.p=TRUE, lower.tail=FALSE)
pgamma(c(1-1e-10, 1+1e-10)*1e100, shape = 1e100)
-pgamma(0.9*1e25, 1e25, log=TRUE)
+pgamma(0.9*1e25, 1e25, log.p=TRUE)
## were NaN, -Inf etc in 2.2.1.
@@ -2260,10 +2260,10 @@ qr.coef(qr(matrix(0:1, 1, dimnames=list(NULL, c("zero","one")))), 5)
## readChar read extra items, terminated on zeros
x <- as.raw(65:74)
-readChar(x, nchar=c(3,3,0,3,3,3))
+readChar(x, nchars=c(3,3,0,3,3,3))
f <- tempfile(tmpdir = getwd())
writeChar("ABCDEFGHIJ", con=f, eos=NULL)
-readChar(f, nchar=c(3,3,0,3,3,3))
+readChar(f, nchars=c(3,3,0,3,3,3))
unlink(f)
##
@@ -2336,7 +2336,7 @@ z[1, ]
## incorrect warning due to lack of fuzz.
-TS <- ts(co2[1:192], freq=24)
+TS <- ts(co2[1:192], frequency=24)
tmp2 <- window(TS, start(TS), end(TS))
## warned in 2.8.0
diff --git a/tests/reg-tests-2.Rout.save b/tests/reg-tests-2.Rout.save
index 4e300d02765..a96bcdfda9e 100644
--- a/tests/reg-tests-2.Rout.save
+++ b/tests/reg-tests-2.Rout.save
@@ -28,7 +28,7 @@ Type 'q()' to quit R.
> ## abbreviate
> for(m in 1:5) {
+ cat("\n",m,":\n")
-+ print(as.vector(abbreviate(state.name, minl=m)))
++ print(as.vector(abbreviate(state.name, minlength=m)))
+ }
1 :
@@ -324,22 +324,22 @@ c 203 215 227 239
> plot(x0,x0, log='xy', ylab="", ylim=c(.1,1e60),type='n',
+ main = "Bessel Functions -Y_nu(x) near 0\n log - log scale")
> for(nu in sort(c(nus,nus+.5))) lines(x0, -besselY(x0,nu=nu), col = nu+2)
-> legend(3,1e50, leg=paste("nu=", paste(nus,nus+.5, sep=",")), col=nus+2, lwd=1)
+> legend(3,1e50, legend=paste("nu=", paste(nus,nus+.5, sep=",")), col=nus+2, lwd=1)
>
> x <- seq(3,500);yl <- c(-.3, .2)
> plot(x,x, ylim = yl, ylab="",type='n', main = "Bessel Functions Y_nu(x)")
> for(nu in nus){xx <- x[x > .6*nu]; lines(xx,besselY(xx,nu=nu), col = nu+2)}
-> legend(300,-.08, leg=paste("nu=",nus), col = nus+2, lwd=1)
+> legend(300,-.08, legend=paste("nu=",nus), col = nus+2, lwd=1)
>
> x <- seq(10,50000,by=10);yl <- c(-.1, .1)
> plot(x,x, ylim = yl, ylab="",type='n', main = "Bessel Functions Y_nu(x)")
> for(nu in nus){xx <- x[x > .6*nu]; lines(xx,besselY(xx,nu=nu), col = nu+2)}
-> summary(bY <- besselY(2,nu = nu <- seq(0,100,len=501)))
+> summary(bY <- besselY(2,nu = nu <- seq(0,100,length.out=501)))
Min. 1st Qu. Median Mean 3rd Qu. Max.
-3.001e+155 -1.067e+107 -1.976e+62 -9.961e+152 -2.059e+23 1.000e+00
> which(bY >= 0)
[1] 1 2 3 4 5
-> summary(bY <- besselY(2,nu = nu <- seq(3,300,len=51)))
+> summary(bY <- besselY(2,nu = nu <- seq(3,300,length.out=51)))
Min. 1st Qu. Median Mean 3rd Qu. Max.
-Inf -Inf -2.248e+263 -Inf -3.777e+116 -1.000e+00
There were 22 warnings (use warnings() to see them)
@@ -417,7 +417,7 @@ numeric(0)
> format.pval(p / 0.9)
[1] "0.05222222" "0.01444444" "0.00222222" "0.00011111" "2.5556e-05"
[6] "5.0000e-06" "< 2.22e-16"
-> format.pval(p / 0.9, dig=3)
+> format.pval(p / 0.9, digits=3)
[1] "0.052222" "0.014444" "0.002222" "0.000111" "2.56e-05" "5.00e-06" "< 2e-16"
> ## end of moved from format.Rd
>
@@ -427,7 +427,7 @@ numeric(0)
> x # 1.000000 -3.000000 Inf -Inf NA 3.141593 NA
[1] 1.000000e+02 -1.000000e-13 Inf -Inf NaN
[6] 3.141593e+00 NA
-> names(x) <- formatC(x, dig=3)
+> names(x) <- formatC(x, digits=3)
> is.finite(x)
100 -1e-13 Inf -Inf NaN 3.14 NA
TRUE TRUE FALSE FALSE FALSE TRUE FALSE
@@ -522,7 +522,7 @@ C:sad 9000 12000 18000 24000 27000 36000 36000 48000
> # dimnames are hard work: let's test them thoroughly
>
> dimnames(bill) <- NULL
-> kronecker(fred, bill, make=TRUE)
+> kronecker(fred, bill, make.dimnames=TRUE)
D: D: E: E: F: F: G: G:
A: 300 400 1200 1600 2100 2800 3000 4000
A: 3000 4000 12000 16000 21000 28000 30000 40000
@@ -530,7 +530,7 @@ B: 600 800 1500 2000 2400 3200 3300 4400
B: 6000 8000 15000 20000 24000 32000 33000 44000
C: 900 1200 1800 2400 2700 3600 3600 4800
C: 9000 12000 18000 24000 27000 36000 36000 48000
-> kronecker(bill, fred, make=TRUE)
+> kronecker(bill, fred, make.dimnames=TRUE)
:D :E :F :G :D :E :F :G
:A 300 1200 2100 3000 400 1600 2800 4000
:B 600 1500 2400 3300 800 2000 3200 4400
@@ -541,7 +541,7 @@ C: 9000 12000 18000 24000 27000 36000 36000 48000
>
> dim(bill) <- c(2, 2, 1)
> dimnames(bill) <- list(c("happy", "sad"), NULL, "")
-> kronecker(fred, bill, make=TRUE)
+> kronecker(fred, bill, make.dimnames=TRUE)
, , :
D: D: E: E: F: F: G: G:
@@ -555,7 +555,7 @@ C:sad 9000 12000 18000 24000 27000 36000 36000 48000
>
> bill <- array(1:24, c(3, 4, 2))
> dimnames(bill) <- list(NULL, NULL, c("happy", "sad"))
-> kronecker(bill, fred, make=TRUE)
+> kronecker(bill, fred, make.dimnames=TRUE)
, , happy:
:D :E :F :G :D :E :F :G :D :E :F :G :D :E :F :G
@@ -582,7 +582,7 @@ C:sad 9000 12000 18000 24000 27000 36000 36000 48000
:B 30 75 120 165 36 90 144 198 42 105 168 231 48 120 192 264
:C 45 90 135 180 54 108 162 216 63 126 189 252 72 144 216 288
-> kronecker(fred, bill, make=TRUE)
+> kronecker(fred, bill, make.dimnames=TRUE)
, , :happy
D: D: D: D: E: E: E: E: F: F: F: F: G: G: G: G:
@@ -611,7 +611,7 @@ C: 45 54 63 72 90 108 126 144 135 162 189 216 180 216 252 288
>
> fred <- outer(fred, c("frequentist"=4, "bayesian"=4000))
-> kronecker(fred, bill, make=TRUE)
+> kronecker(fred, bill, make.dimnames=TRUE)
, , frequentist:happy
D: D: D: D: E: E: E: E: F: F: F: F: G: G: G: G:
@@ -1205,7 +1205,7 @@ coef[ 15] = 0.0008658
> ## fixed by patch from Adrian Trapletti 2001-03-08
>
> ## Start new year (i.e. line) at Jan:
-> (tt <- ts(1:10, start = c(1920,7), end = c(1921,4), freq = 12))
+> (tt <- ts(1:10, start = c(1920,7), end = c(1921,4), frequency = 12))
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1920 1 2 3 4 5 6
1921 7 8 9 10
@@ -1312,11 +1312,11 @@ character(0)
> f.bar <- function(x) { on.exit(e <<- g()); return(NULL) }
> f(structure(1,class = "foo"))
NULL
-> ls(env = e)# only "x", i.e. *not* the GlobalEnv
+> ls(envir = e)# only "x", i.e. *not* the GlobalEnv
[1] "x"
> f(structure(1,class = "bar"))
NULL
-> stopifnot("x" == ls(env = e))# as above; wrongly was .GlobalEnv in R 1.3.x
+> stopifnot("x" == ls(envir = e))# as above; wrongly was .GlobalEnv in R 1.3.x
>
>
> ## some tests that R supports logical variables in formulae
@@ -1710,8 +1710,8 @@ Levels: NA a b
>
> ## print.ts problems ggrothendieck@yifan.net on R-help, 2002-04-01
> x <- 1:20
-> tt1 <- ts(x,start=c(1960,2), freq=12)
-> tt2 <- ts(10+x,start=c(1960,2), freq=12)
+> tt1 <- ts(x,start=c(1960,2), frequency=12)
+> tt2 <- ts(10+x,start=c(1960,2), frequency=12)
> cbind(tt1, tt2)
tt1 tt2
Feb 1960 1 11
@@ -1857,7 +1857,7 @@ Coefficients:
> (qq <- sapply(0:5, function(k) {
+ x <- c(rep(-Inf,k+1), 0:k, rep(Inf, k))
+ sapply(1:9, function(typ)
-+ quantile(x, pr=(2:10)/10, type=typ))
++ quantile(x, probs=(2:10)/10, type=typ))
+ }, simplify="array"))
, , 1
@@ -2237,12 +2237,12 @@ Levels: A B C
> for(j.fac in 1e-12* c(10, 1, .7, .3, .2, .1, .05, .03, .01)) {
+ ## ====
+ #set.seed(101) # or don't
-+ x <- pi + jitter(numeric(101), f = j.fac)
-+ rrtxt <- paste("rel.range =", formatC(relrange(x), dig = 4),"* EPS")
++ x <- pi + jitter(numeric(101), factor = j.fac)
++ rrtxt <- paste("rel.range =", formatC(relrange(x), digits = 4),"* EPS")
+ cat("j.f = ", format(j.fac)," ; ", rrtxt,"\n",sep="")
+ plot(x, type = "l", main = rrtxt)
-+ cat("par(\"usr\")[3:4]:", formatC(par("usr")[3:4], wid = 10),"\n",
-+ "par(\"yaxp\") : ", formatC(par("yaxp"), wid = 10),"\n\n", sep="")
++ cat("par(\"usr\")[3:4]:", formatC(par("usr")[3:4], width = 10),"\n",
++ "par(\"yaxp\") : ", formatC(par("yaxp"), width = 10),"\n\n", sep="")
+ }
j.f = 1e-11 ; rel.range = 553.9 * EPS
par("usr")[3:4]: 3.142 3.142
@@ -2403,7 +2403,7 @@ Coefficients:
(Intercept) x1 x2 x3
1.4719 0.5867 NA 0.2587
-> summary(fit, cor = TRUE)
+> summary(fit, correlation = TRUE)
Call:
lm(formula = y ~ x1 + x2 + x3)
@@ -2439,7 +2439,7 @@ Coefficients:
Degrees of Freedom: 9 Total (i.e. Null); 7 Residual
Null Deviance: 67.53
Residual Deviance: 4.551 AIC: 28.51
-> summary(fit, cor = TRUE)
+> summary(fit, correlation = TRUE)
Call:
glm(formula = y ~ x1 + x2 + x3)
@@ -2638,7 +2638,7 @@ Residuals 10 2.7404 0.27404
> predict(fit)
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
-> predict(fit, data.frame(x=x), se=TRUE)
+> predict(fit, data.frame(x=x), se.fit=TRUE)
$fit
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
@@ -2652,7 +2652,7 @@ $df
$residual.scale
[1] 0.5234843
-> predict(fit, type="terms", se=TRUE)
+> predict(fit, type="terms", se.fit=TRUE)
$fit
[1,]
@@ -2738,7 +2738,7 @@ Residuals 10 2.7404 0.27404
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
> tools::assertWarning(
-+ predict(fit, data.frame(x=x), se=TRUE) -> p0
++ predict(fit, data.frame(x=x), se.fit=TRUE) -> p0
+ )
> p0
$fit
@@ -2759,7 +2759,7 @@ $residual.scale
> if(FALSE)## not yet:
+ stopifnot(identical(p0$fit, predict(fit, data.frame(x=x), rankdeficient = "NA")))
-> predict(fit, type="terms", se=TRUE)
+> predict(fit, type="terms", se.fit=TRUE)
$fit
x
1 0
@@ -2851,7 +2851,7 @@ NULL 10 2.7404
> predict(fit)
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
-> predict(fit, data.frame(x=x), se=TRUE)
+> predict(fit, data.frame(x=x), se.fit=TRUE)
$fit
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
@@ -2862,7 +2862,7 @@ $se.fit
$residual.scale
[1] 0.5234843
-> predict(fit, type="terms", se=TRUE)
+> predict(fit, type="terms", se.fit=TRUE)
$fit
[1,]
@@ -2940,7 +2940,7 @@ x 0 0 10 2.7404
1 2 3 4 5 6 7 8 9 10
0 0 0 0 0 0 0 0 0 0
> tools::assertWarning(
-+ predict(fit, data.frame(x=x), se=TRUE) -> p0
++ predict(fit, data.frame(x=x), se.fit=TRUE) -> p0
+ )
> p0
$fit
@@ -2958,7 +2958,7 @@ $residual.scale
> if(FALSE)## not yet:
+ stopifnot(identical(p0$fit, predict(fit, data.frame(x=x), rankdeficient = "NA")))
-> predict(fit, type="terms", se=TRUE)
+> predict(fit, type="terms", se.fit=TRUE)
$fit
x
1 0
@@ -3624,7 +3624,7 @@ NULL
>
>
> ## S compatibility change in 1.9.0
-> rep(1:2, each=3, length=12)
+> rep(1:2, each=3, length.out=12)
[1] 1 1 1 2 2 2 1 1 1 2 2 2
> ## used to pad with NAs.
>
@@ -4216,7 +4216,7 @@ Warning message:
> ## used '.' not ',' in 2.0.0
>
> ## splinefun() value test
-> (x <- seq(0,6, length=25))
+> (x <- seq(0,6, length.out=25))
[1] 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50
[16] 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00
> mx <- sapply(c("fmm", "nat", "per"),
@@ -4253,17 +4253,17 @@ Warning message:
> ## infinite loop in read.fwf (PR#7350)
> cat(file="test.txt", sep = "\n", "# comment 1", "1234567 # comment 2",
+ "1 234567 # comment 3", "12345 67 # comment 4", "# comment 5")
-> read.fwf("test.txt", width=c(2,2,3), skip=1, n=4) # looped
+> read.fwf("test.txt", widths=c(2,2,3), skip=1, n=4) # looped
V1 V2 V3
1 12 34 567
2 1 23 456
3 12 34 5
-> read.fwf("test.txt", width=c(2,2,3), skip=1) # 1 line short
+> read.fwf("test.txt", widths=c(2,2,3), skip=1) # 1 line short
V1 V2 V3
1 12 34 567
2 1 23 456
3 12 34 5
-> read.fwf("test.txt", width=c(2,2,3), skip=0)
+> read.fwf("test.txt", widths=c(2,2,3), skip=0)
V1 V2 V3
1 12 34 567
2 1 23 456
@@ -4423,7 +4423,7 @@ b 2 2
"a" 1 1
"b" 2 2
>
-> x3 <- seq(as.Date("2005-01-01"), len=6, by="day")
+> x3 <- seq(as.Date("2005-01-01"), length.out=6, by="day")
> x4 <- data.frame(x=1:6, y=x3)
> dim(x3) <- c(2,3)
> x3
@@ -4453,11 +4453,11 @@ b 2 2
>
>
> ## Problem with earlier regexp code spotted by KH
-> grep("(.*s){2}", "Arkansas", v = TRUE)
+> grep("(.*s){2}", "Arkansas", value = TRUE)
[1] "Arkansas"
-> grep("(.*s){3}", "Arkansas", v = TRUE)
+> grep("(.*s){3}", "Arkansas", value = TRUE)
character(0)
-> grep("(.*s){3}", state.name, v = TRUE)
+> grep("(.*s){3}", state.name, value = TRUE)
[1] "Massachusetts" "Mississippi"
> ## Thought Arkansas had 3 s's.
>
@@ -4976,7 +4976,7 @@ NULL
>
> ## formatC on Windows (PR#8337)
> xx <- pi * 10^(-5:4)
-> cbind(formatC(xx, wid = 9))
+> cbind(formatC(xx, width = 9))
[,1]
[1,] "3.142e-05"
[2,] "0.0003142"
@@ -4988,7 +4988,7 @@ NULL
[8,] " 314.2"
[9,] " 3142"
[10,] "3.142e+04"
-> cbind(formatC(xx, wid = 9, flag = "-"))
+> cbind(formatC(xx, width = 9, flag = "-"))
[,1]
[1,] "3.142e-05"
[2,] "0.0003142"
@@ -5000,7 +5000,7 @@ NULL
[8,] "314.2 "
[9,] "3142 "
[10,] "3.142e+04"
-> cbind(formatC(xx, wid = 9, flag = "0"))
+> cbind(formatC(xx, width = 9, flag = "0"))
[,1]
[1,] "3.142e-05"
[2,] "0.0003142"
@@ -5047,17 +5047,17 @@ Reaction ~ Days + (Days | Subject) + I(Days^2)
>
>
> ## PR#8528: errors in the post-2.1.0 pgamma
-> pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log=TRUE)
+> pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log.p=TRUE)
[1] -3.768207e+98 -2.314355e+98 -1.251893e+98 -5.360516e+97 -1.293294e+97
[6] -6.931472e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11] 0.000000e+00
-> pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log=TRUE, lower=FALSE)
+> pgamma(seq(0.75, 1.25, by=0.05)*1e100, shape = 1e100, log.p=TRUE, lower.tail=FALSE)
[1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6] -6.931472e-01 -1.209836e+97 -4.689820e+97 -1.023806e+98 -1.767844e+98
[11] -2.685645e+98
> pgamma(c(1-1e-10, 1+1e-10)*1e100, shape = 1e100)
[1] 0 1
-> pgamma(0.9*1e25, 1e25, log=TRUE)
+> pgamma(0.9*1e25, 1e25, log.p=TRUE)
[1] -5.360516e+22
> ## were NaN, -Inf etc in 2.2.1.
>
@@ -6134,11 +6134,11 @@ zero one
>
> ## readChar read extra items, terminated on zeros
> x <- as.raw(65:74)
-> readChar(x, nchar=c(3,3,0,3,3,3))
+> readChar(x, nchars=c(3,3,0,3,3,3))
[1] "ABC" "DEF" "" "GHI" "J"
> f <- tempfile(tmpdir = getwd())
> writeChar("ABCDEFGHIJ", con=f, eos=NULL)
-> readChar(f, nchar=c(3,3,0,3,3,3))
+> readChar(f, nchars=c(3,3,0,3,3,3))
[1] "ABC" "DEF" "" "GHI" "J"
> unlink(f)
> ##
@@ -6309,7 +6309,7 @@ Error in aggregate.data.frame(z, by = z[1], FUN = sum) :
>
>
> ## incorrect warning due to lack of fuzz.
-> TS <- ts(co2[1:192], freq=24)
+> TS <- ts(co2[1:192], frequency=24)
> tmp2 <- window(TS, start(TS), end(TS))
> ## warned in 2.8.0
>
diff --git a/tests/simple-true.R b/tests/simple-true.R
index 8cd9cbf395c..d3be2a50217 100644
--- a/tests/simple-true.R
+++ b/tests/simple-true.R
@@ -22,7 +22,7 @@ inherits(try(parse(text = "12iL"), silent=TRUE), "try-error") # gives syntax err
all((0:6) == pi + ((-pi):pi))
-all((0:7) == (pi+seq(-pi,pi, length=8))*7/(2*pi))
+all((0:7) == (pi+seq(-pi,pi, length.out=8))*7/(2*pi))
1 == as.integer(is.na(c(pi,NA)[2]))
1 == as.integer(is.nan(0/0))
diff --git a/tests/simple-true.Rout.save b/tests/simple-true.Rout.save
index 324d604b769..ea06f6e5b2f 100644
--- a/tests/simple-true.Rout.save
+++ b/tests/simple-true.Rout.save
@@ -54,7 +54,7 @@ integer literal 1.L contains unnecessary decimal point
>
> all((0:6) == pi + ((-pi):pi))
[1] TRUE
-> all((0:7) == (pi+seq(-pi,pi, length=8))*7/(2*pi))
+> all((0:7) == (pi+seq(-pi,pi, length.out=8))*7/(2*pi))
[1] TRUE
>
> 1 == as.integer(is.na(c(pi,NA)[2]))