From 5227068948ac8296c70a90a06c85e838ab81b802 Mon Sep 17 00:00:00 2001 From: sebhrusen Date: Wed, 1 Nov 2023 18:07:30 +0100 Subject: [PATCH] in R, ensure the deprecated args are checked first --- h2o-r/h2o-package/R/models.R | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/h2o-r/h2o-package/R/models.R b/h2o-r/h2o-package/R/models.R index 8ed81619628c..7f8a6429b2dc 100755 --- a/h2o-r/h2o-package/R/models.R +++ b/h2o-r/h2o-package/R/models.R @@ -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") @@ -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)