Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate pairs, add pairs_profile. #2

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
^pkgdown$
^\.github$
^CRAN-SUBMISSION$
^revdep$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.httr-oauth
.DS_Store
docs
revdep
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: ellipse
Version: 0.4.5
Version: 0.5.0
Title: Functions for Drawing Ellipses and Ellipse-Like Confidence Regions
Author: Duncan Murdoch and E. D. Chow (porting to R by Jesus M. Frias Celayeta)
Maintainer: Duncan Murdoch <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export(ellipse,plotcorr,pairs)
export(ellipse,plotcorr,pairs_profile, pairs)

importFrom("graphics", "axis", "box", "lines", "mtext", "par", "plot",
"plot.new", "polygon", "strwidth", "text")
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Version 0.5.0

* The `pairs()` generic and `pairs.profile()` method have both
been deprecated, and replaced with the `pairs_profile()` function.

## Version 0.4.5

* `center` was ignored in `ellipse.default()`.
Expand Down
11 changes: 9 additions & 2 deletions R/pairs.profile.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
pairs <- function(x, ...)
pairs <- function(x, ...) {
if (inherits(x, "profile"))
.Deprecated("pairs_profile", msg = "ellipse::pairs is deprecated for profile objects. Use ellipse::pairs_profile instead.")
UseMethod("pairs")
}

.pairs_default <- function(x, ...)
graphics::pairs(x, ...)
Expand All @@ -19,11 +22,13 @@ pairs <- function(x, ...)
graphics::pairs(mf, ...)
}

"pairs.profile" <-
pairs_profile <-
function (x, labels = c(names(x), "Profile tau"), panel = lines,
invert = TRUE, plot.tau = TRUE, plot.trace = TRUE, plot.sketch = TRUE,
plot.ellipse = FALSE, level = 0.95, ...)
{
stopifnot(inherits(x, "profile"))

doaxis <- function(which, dolabel = TRUE) axis(which, labels = dolabel) # outer = TRUE, line = -0.5, labels = dolabel)
setup <- function(x, y, ...) plot(range(x[!is.na(x)]),
range(y[!is.na(y)]), type = "n", axes = FALSE, ...)
Expand Down Expand Up @@ -130,3 +135,5 @@ pairs <- function(x, ...)
}
invisible()
}

pairs.profile <- pairs_profile
19 changes: 15 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
### 0.4.5: A bug fix update:
### ellipse 0.5:

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

### R CMD check results

0 errors | 0 warnings | 0 notes

## revdepcheck results

We checked 71 reverse dependencies (63 from CRAN + 8 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages


44 changes: 0 additions & 44 deletions man/pairs.Rd

This file was deleted.

62 changes: 32 additions & 30 deletions man/pairs.profile.Rd
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
\name{pairs.profile}
\name{pairs_profile}
\alias{pairs_profile}
\alias{pairs.profile}
\alias{ellipse-deprecated}
\alias{pairs}
\title{
Profile pairs
}
Expand All @@ -8,14 +11,17 @@ This function produces pairwise plots of profile traces, profile
sketches, and ellipse approximations to confidence intervals.
}
\usage{
\method{pairs}{profile}(x, labels = c(names(x), "Profile tau"), panel = lines, invert = TRUE,
pairs_profile(x, labels = c(names(x), "Profile tau"), panel = lines, invert = TRUE,
plot.tau = TRUE, plot.trace = TRUE, plot.sketch = TRUE,
plot.ellipse = FALSE, level = 0.95, \dots)

# Deprecated generic function. Use graphics::pairs instead.
pairs(x, ...)
}
\arguments{
\item{x}{
An object of class \code{profile}, generally the result of the \code{profile()}
function.
function.
}
\item{labels}{
The labels to use for each variable. These default to the variable
Expand Down Expand Up @@ -53,35 +59,27 @@ profile object.
This function implements the plots used in Bates and Watts (1988) for
nonlinear regression diagnostics.

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

If \code{x} is a profile object, then \code{ellipse::pairs(x)}
is guaranteed to call the method from this package. If you'd rather use
the \pkg{MASS} method, then two steps are needed: you need to
be sure that \pkg{MASS} is loaded, then call \code{graphics::pairs(x)}.
(If \pkg{MASS} is not loaded, you'll get the default method from the \pkg{graphics} package, which will
trigger an error since it doesn't know about profile
objects.)

If both \pkg{ellipse} and \pkg{MASS} are loaded, then \code{pairs(x)}
is slightly ambiguous: the method that is called depends
on the ordering of \pkg{ellipse} and \pkg{graphics} (not \pkg{MASS}!) in the search list. In almost all cases
\pkg{ellipse} will precede \pkg{graphics}, so the \pkg{ellipse} method will usually be the default.


If \code{x} is any object
other than a profile object, \code{ellipse::pairs(x)}
will pass the call on to \code{graphics::pairs(x)},
and the standard method will be called.
If \code{x} is a profile object then \code{pairs_profile(x)}
will call the function from this package. If you'd rather use
the \pkg{MASS}/\pkg{stats} method, then make sure the appropriate
package is loaded, and call \code{pairs(x)}. (Prior to
\pkg{ellipse} 0.5, there were complicated rules to determine what
\code{pairs(x)} would do; those should still work for now, but
\code{ellipse::pairs} will disappear in a future release.)
}
\references{
Bates and Watts (1988). Nonlinear Regression Analysis and Its Applications. Wiley. \doi{10.1002/9780470316757}.
}
\seealso{
\code{\link{profile}}, \code{\link{ellipse.profile}}, \code{\link{ellipse.nls}}
\code{\link{pairs}}, \code{\link{profile}}, \code{\link{ellipse.profile}}, \code{\link{ellipse.nls}}
}
\examples{
# Plot everything for the Puromycin data
Expand All @@ -90,11 +88,15 @@ Bates and Watts (1988). Nonlinear Regression Analysis and Its Applications. Wile
* conc)/(K + conc), data = Puromycin,
start = list(Vm = 160, delV = 40, K = 0.05))
Pur.prof <- profile(Purboth)
ellipse::pairs(Pur.prof, plot.ellipse = TRUE)
pairs_profile(Pur.prof, plot.ellipse = TRUE)

# Show the corresponding plot from MASS:
if (requireNamespace("MASS"))
graphics::pairs(Pur.prof)
# Show the corresponding plot from MASS/stats:
if (getRversion() < "4.4.0") {
loadNamespace("MASS")
} else
loadNamespace("stats")

graphics::pairs(Pur.prof)
}
\keyword{dplot}
\keyword{regression}
Expand Down