Skip to content

Commit ba11b9e

Browse files
committedJul 20, 2023
Deprecate pairs, add pairs_profile.
1 parent e1824eb commit ba11b9e

9 files changed

+54
-82
lines changed
 

‎.Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
^pkgdown$
88
^\.github$
99
^CRAN-SUBMISSION$
10+
^revdep$

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.httr-oauth
55
.DS_Store
66
docs
7+
revdep

‎DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: ellipse
2-
Version: 0.4.5
2+
Version: 0.5
33
Title: Functions for Drawing Ellipses and Ellipse-Like Confidence Regions
44
Author: Duncan Murdoch and E. D. Chow (porting to R by Jesus M. Frias Celayeta)
55
Maintainer: Duncan Murdoch <murdoch.duncan@gmail.com>

‎NAMESPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export(ellipse,plotcorr,pairs)
1+
export(ellipse,plotcorr,pairs_profile, pairs)
22

33
importFrom("graphics", "axis", "box", "lines", "mtext", "par", "plot",
44
"plot.new", "polygon", "strwidth", "text")

‎NEWS.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Version 0.5
2+
3+
* The `pairs()` generic and `pairs.profile()` method have both
4+
been deprecated, and replaced with the `pairs_profile()` function.
5+
16
## Version 0.4.5
27

38
* `center` was ignored in `ellipse.default()`.

‎R/pairs.profile.R

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
pairs <- function(x, ...)
1+
pairs <- function(x, ...) {
2+
.Deprecated("pairs_profile or graphics::pairs", "ellipse")
23
UseMethod("pairs")
4+
}
35

46
.pairs_default <- function(x, ...)
57
graphics::pairs(x, ...)
@@ -19,11 +21,13 @@ pairs <- function(x, ...)
1921
graphics::pairs(mf, ...)
2022
}
2123

22-
"pairs.profile" <-
24+
pairs_profile <-
2325
function (x, labels = c(names(x), "Profile tau"), panel = lines,
2426
invert = TRUE, plot.tau = TRUE, plot.trace = TRUE, plot.sketch = TRUE,
2527
plot.ellipse = FALSE, level = 0.95, ...)
2628
{
29+
stopifnot(inherits(x, "profile"))
30+
2731
doaxis <- function(which, dolabel = TRUE) axis(which, labels = dolabel) # outer = TRUE, line = -0.5, labels = dolabel)
2832
setup <- function(x, y, ...) plot(range(x[!is.na(x)]),
2933
range(y[!is.na(y)]), type = "n", axes = FALSE, ...)
@@ -130,3 +134,5 @@ pairs <- function(x, ...)
130134
}
131135
invisible()
132136
}
137+
138+
pairs.profile <- pairs_profile

‎cran-comments.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
### 0.4.5: A bug fix update:
1+
### ellipse 0.5:
22

3-
Sorry for missing this, but there's a simple error in the
4-
new code from the previous submission that needs fixing: the
5-
new `center` parameter is completely ignored.
3+
This change is at the request of Prof. Ripley, to prepare for the
4+
move of `MASS::pairs.profile` to `stats`. In this release, I have
5+
added a function `pairs_profile`, while deprecating `pairs`. Before R 4.4.0 comes out, I intend to remove `pairs` and `pairs.profile`, keeping
6+
only the new function.
67

78
### R CMD check results
89

‎man/pairs.Rd

-44
This file was deleted.

‎man/pairs.profile.Rd

+32-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
\name{pairs.profile}
1+
\name{pairs_profile}
2+
\alias{pairs_profile}
23
\alias{pairs.profile}
4+
\alias{ellipse-deprecated}
5+
\alias{pairs}
36
\title{
47
Profile pairs
58
}
@@ -8,14 +11,17 @@ This function produces pairwise plots of profile traces, profile
811
sketches, and ellipse approximations to confidence intervals.
912
}
1013
\usage{
11-
\method{pairs}{profile}(x, labels = c(names(x), "Profile tau"), panel = lines, invert = TRUE,
14+
pairs_profile(x, labels = c(names(x), "Profile tau"), panel = lines, invert = TRUE,
1215
plot.tau = TRUE, plot.trace = TRUE, plot.sketch = TRUE,
1316
plot.ellipse = FALSE, level = 0.95, \dots)
17+
18+
# Deprecated generic function. Use graphics::pairs instead.
19+
pairs(x, ...)
1420
}
1521
\arguments{
1622
\item{x}{
1723
An object of class \code{profile}, generally the result of the \code{profile()}
18-
function.
24+
function.
1925
}
2026
\item{labels}{
2127
The labels to use for each variable. These default to the variable
@@ -53,35 +59,27 @@ profile object.
5359
This function implements the plots used in Bates and Watts (1988) for
5460
nonlinear regression diagnostics.
5561

56-
Unfortunately, the \pkg{MASS} package also defines a
57-
\code{\link[MASS:plot.profile]{pairs.profile}} method. The \code{ellipse::\link{pairs}}
58-
generic is supplied to allow users to choose to use
59-
the version in this package.
62+
Prior to \pkg{ellipse} version 0.5,
63+
the \code{pairs_profile} function was a \code{profile}
64+
method for the \code{pairs} generic. This caused
65+
various conflicts, because \pkg{graphics} also exports a \code{pairs}
66+
generic, and package \pkg{MASS} exported a \code{profile}
67+
method for \code{graphics::pairs}. As of \R version 4.4.0,
68+
the \pkg{MASS} method will be in \pkg{stats} instead.
6069

61-
If \code{x} is a profile object, then \code{ellipse::pairs(x)}
62-
is guaranteed to call the method from this package. If you'd rather use
63-
the \pkg{MASS} method, then two steps are needed: you need to
64-
be sure that \pkg{MASS} is loaded, then call \code{graphics::pairs(x)}.
65-
(If \pkg{MASS} is not loaded, you'll get the default method from the \pkg{graphics} package, which will
66-
trigger an error since it doesn't know about profile
67-
objects.)
68-
69-
If both \pkg{ellipse} and \pkg{MASS} are loaded, then \code{pairs(x)}
70-
is slightly ambiguous: the method that is called depends
71-
on the ordering of \pkg{ellipse} and \pkg{graphics} (not \pkg{MASS}!) in the search list. In almost all cases
72-
\pkg{ellipse} will precede \pkg{graphics}, so the \pkg{ellipse} method will usually be the default.
73-
74-
75-
If \code{x} is any object
76-
other than a profile object, \code{ellipse::pairs(x)}
77-
will pass the call on to \code{graphics::pairs(x)},
78-
and the standard method will be called.
70+
If \code{x} is a profile object then \code{pairs_profile(x)}
71+
will call the function from this package. If you'd rather use
72+
the \pkg{MASS}/\pkg{stats} method, then make sure the appropriate
73+
package is loaded, and call \code{pairs(x)}. (Prior to
74+
\pkg{ellipse} 0.5, there were complicated rules to determine what
75+
\code{pairs(x)} would do; those should still work for now, but
76+
\code{ellipse::pairs} will disappear in a future release.)
7977
}
8078
\references{
8179
Bates and Watts (1988). Nonlinear Regression Analysis and Its Applications. Wiley. \doi{10.1002/9780470316757}.
8280
}
8381
\seealso{
84-
\code{\link{profile}}, \code{\link{ellipse.profile}}, \code{\link{ellipse.nls}}
82+
\code{\link{pairs}}, \code{\link{profile}}, \code{\link{ellipse.profile}}, \code{\link{ellipse.nls}}
8583
}
8684
\examples{
8785
# Plot everything for the Puromycin data
@@ -90,11 +88,15 @@ Bates and Watts (1988). Nonlinear Regression Analysis and Its Applications. Wile
9088
* conc)/(K + conc), data = Puromycin,
9189
start = list(Vm = 160, delV = 40, K = 0.05))
9290
Pur.prof <- profile(Purboth)
93-
ellipse::pairs(Pur.prof, plot.ellipse = TRUE)
91+
pairs_profile(Pur.prof, plot.ellipse = TRUE)
9492
95-
# Show the corresponding plot from MASS:
96-
if (requireNamespace("MASS"))
97-
graphics::pairs(Pur.prof)
93+
# Show the corresponding plot from MASS/stats:
94+
if (getRversion() < "4.4.0") {
95+
loadNamespace("MASS")
96+
} else
97+
loadNamespace("stats")
98+
99+
graphics::pairs(Pur.prof)
98100
}
99101
\keyword{dplot}
100102
\keyword{regression}

0 commit comments

Comments
 (0)
Please sign in to comment.