Skip to content

Commit 26cf62b

Browse files
ehrlingerclaude
andcommitted
refactor(gg_isopro): move newdata after ... for back-compat
Address Copilot review on PR #96: placing newdata as the 2nd positional argument would change positional matching for any caller of the PR #94 signature gg_isopro(object, ...). Moving newdata after ... means it can only be matched by name, so existing positional calls are unaffected. All tests already pass newdata by name; no test changes needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d143075 commit 26cf62b

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

R/gg_isopro.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,16 @@
110110
#'
111111
#' @param object An \code{isopro} fit returned by
112112
#' \code{\link[varPro]{isopro}}.
113+
#' @param ... Currently unused. Present before \code{newdata} so that
114+
#' \code{newdata} is only matched by name, preserving backward
115+
#' compatibility with callers of the PR #94 signature
116+
#' \code{gg_isopro(object, ...)}.
113117
#' @param newdata Optional \code{data.frame} of new observations to score
114-
#' against the fit. When \code{NULL} (default) the extractor returns the
115-
#' in-sample tidy frame from the fit's stored \code{$case.depth} and
116-
#' \code{$howbad}. When supplied, each row is scored via
117-
#' \code{\link[varPro]{predict.isopro}} and the same tidy shape is
118-
#' returned for the test data.
119-
#' @param ... Currently unused.
118+
#' against the fit. Must be passed by name. When \code{NULL} (default)
119+
#' the extractor returns the in-sample tidy frame from the fit's stored
120+
#' \code{$case.depth} and \code{$howbad}. When supplied, each row is
121+
#' scored via \code{\link[varPro]{predict.isopro}} and the same tidy
122+
#' shape is returned for the test data.
120123
#'
121124
#' @return A \code{data.frame} of class \code{c("gg_isopro", "data.frame")},
122125
#' one row per observation. Columns:
@@ -164,12 +167,12 @@
164167
#' }
165168
#'
166169
#' @export
167-
gg_isopro <- function(object, newdata = NULL, ...) {
170+
gg_isopro <- function(object, ..., newdata = NULL) {
168171
UseMethod("gg_isopro", object)
169172
}
170173

171174
#' @export
172-
gg_isopro.isopro <- function(object, newdata = NULL, ...) {
175+
gg_isopro.isopro <- function(object, ..., newdata = NULL) {
173176
if (!inherits(object, "isopro")) {
174177
stop("gg_isopro expects a 'isopro' object from varPro::isopro().",
175178
call. = FALSE)

man/gg_isopro.Rd

Lines changed: 11 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)