Skip to content

Commit

Permalink
in R, ensure the deprecated args are checked first
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhrusen committed Nov 1, 2023
1 parent 4c798ce commit 5227068
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions h2o-r/h2o-package/R/models.R
Original file line number Diff line number Diff line change
Expand Up @@ -5624,6 +5624,13 @@ h2o.partialPlot <- function(object, newdata, cols, destination_key, nbins=20, pl
weight_column=-1, include_na=FALSE, user_splits=NULL, col_pairs_2dpdp=NULL, save_to=NULL,
row_index=-1, targets=NULL, ...) {
varargs <- list(...)
for (arg in names(varargs)) {
if (arg == 'data') {
warning("argument 'data' is deprecated; please use 'newdata' instead.")
if (missing(newdata))
newdata <- varargs$data else warning("ignoring 'data' as 'newdata' was also provided.")
}
}
if(!is(object, "H2OModel")) stop("object must be an H2Omodel")
if( is(object, "H2OOrdinalModel")) stop("object must be a regression model or binary and multinomial classfier")
if(!is(newdata, "H2OFrame")) stop("newdata must be H2OFrame")
Expand All @@ -5637,12 +5644,6 @@ h2o.partialPlot <- function(object, newdata, cols, destination_key, nbins=20, pl
if(!is.character(targets[i])) stop("targets parameter must be a list of string values")
}
}
for (arg in names(varargs)) {
if (arg == 'data') {
warning("argument 'data' is deprecated; please use 'newdata' instead.")
if (missing(newdata)) newdata <- varargs$data else warning("ignoring 'data' as 'newdata' was also provided.")
}
}

noPairs <- missing(col_pairs_2dpdp)
noCols <- missing(cols)
Expand Down

0 comments on commit 5227068

Please sign in to comment.