Skip to content

Remove resampleWrapper(): exported, uncalled, and broken since before 2014 #1518

Open

Description

@topepo

resampleWrapper() is exported but cannot run, and nothing in the package calls it.

library(caret)
df <- data.frame(a = rnorm(20), b = rnorm(20), .outcome = rnorm(20))
x <- list(data = df, method = getModelInfo("lm", regex = FALSE)[[1]])
caret:::resampleWrapper(x, 1:15)
#> Error in do.call(createModel, x) : argument "x" is missing, with no default

The body builds its argument list around x$data:

resampleWrapper <- function(x, ind) {
  out <- rep(NA, dim(x$data)[1])
  trainData <- x$data
  x$data <- x$data[ind, ]
  tmpModelFit <- do.call(createModel, x)
  ...
}

That matches a createModel(data = ...) signature which does not exist in this repository's history: at the first commit (caret 6.0-30, 2014) pkg/caret/R/createModel.R already defined createModel2(x, y, wts, method, tuneValue, obsLevels, pp, last, classProbs, ...). So data lands in ... while x and y are never supplied.

grep -rn resampleWrapper R/ finds only the definition and the @aliases line in createModel.Rd; the only other reference is export(resampleWrapper) in NAMESPACE.

Since it is exported, it is grouped with the other dead exports for removal after a reverse-dependency check (as was done for predict.PLS() in #1512). Nothing can be calling it successfully, but the export is public API.

Found while raising test coverage: it is the only file left at 0%, and there is nothing meaningful to test.

Activity

  1. topepo commented on Aug 24, 2026

    @topepo
    OwnerAuthor

    Removed. The reverse-dependency check this was waiting on: a scan of the source
    tarballs under revdep/checks.noindex found resampleWrapper in 0 of 243
    packages (as a control, trainControl appears in 76 of them). Nothing could
    have been calling it successfully in any case, since the call to
    createModel() errors immediately.

    Gone with it: export(resampleWrapper) in NAMESPACE, the \alias and
    \usage line in man/caret-internal.Rd, and the name in createModel()'s
    roxygen @aliases. R CMD check is clean on namespace information, Rd files,
    \usage sections and missing-documentation entries. NEWS entry added under
    7.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions