From 4b7e2b7bffa10bd6d431fb90aab545419ebf95c2 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 20 Mar 2020 08:51:20 -0500 Subject: [PATCH] [R-package] fixed uses of class() (#5426) Thank you a lot. Good catch! --- R-package/R/utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R-package/R/utils.R b/R-package/R/utils.R index 75482e10a..0e0995460 100644 --- a/R-package/R/utils.R +++ b/R-package/R/utils.R @@ -28,7 +28,7 @@ NVL <- function(x, val) { # Merges booster params with whatever is provided in ... # plus runs some checks check.booster.params <- function(params, ...) { - if (typeof(params) != "list") + if (!identical(class(params), "list")) stop("params must be a list") # in R interface, allow for '.' instead of '_' in parameter names @@ -78,7 +78,7 @@ check.booster.params <- function(params, ...) { if (!is.null(params[['interaction_constraints']]) && typeof(params[['interaction_constraints']]) != "character"){ # check input class - if (class(params[['interaction_constraints']]) != 'list') stop('interaction_constraints should be class list') + if (!identical(class(params[['interaction_constraints']]),'list')) stop('interaction_constraints should be class list') if (!all(unique(sapply(params[['interaction_constraints']], class)) %in% c('numeric','integer'))) { stop('interaction_constraints should be a list of numeric/integer vectors') }