[R] [CI] add more linting checks (#8624)
This commit is contained in:
@@ -328,7 +328,6 @@ setinfo.xgb.DMatrix <- function(object, name, info, ...) {
|
||||
return(TRUE)
|
||||
}
|
||||
stop("setinfo: unknown info name ", name)
|
||||
return(FALSE)
|
||||
}
|
||||
|
||||
|
||||
@@ -418,7 +417,7 @@ print.xgb.DMatrix <- function(x, verbose = FALSE, ...) {
|
||||
cat(infos)
|
||||
cnames <- colnames(x)
|
||||
cat(' colnames:')
|
||||
if (verbose & !is.null(cnames)) {
|
||||
if (verbose && !is.null(cnames)) {
|
||||
cat("\n'")
|
||||
cat(cnames, sep = "','")
|
||||
cat("'")
|
||||
|
||||
@@ -143,7 +143,7 @@ xgb.plot.shap <- function(data, shap_contrib = NULL, features = NULL, top_n = 1,
|
||||
y <- shap_contrib[, f][ord]
|
||||
x_lim <- range(x, na.rm = TRUE)
|
||||
y_lim <- range(y, na.rm = TRUE)
|
||||
do_na <- plot_NA && any(is.na(x))
|
||||
do_na <- plot_NA && anyNA(x)
|
||||
if (do_na) {
|
||||
x_range <- diff(x_lim)
|
||||
loc_na <- min(x, na.rm = TRUE) + x_range * pos_NA
|
||||
@@ -272,7 +272,7 @@ xgb.shap.data <- function(data, shap_contrib = NULL, features = NULL, top_n = 1,
|
||||
imp <- xgb.importance(model = model, trees = trees, feature_names = colnames(data))
|
||||
}
|
||||
top_n <- top_n[1]
|
||||
if (top_n < 1 | top_n > 100) stop("top_n: must be an integer within [1, 100]")
|
||||
if (top_n < 1 || top_n > 100) stop("top_n: must be an integer within [1, 100]")
|
||||
features <- imp$Feature[seq_len(min(top_n, NROW(imp)))]
|
||||
}
|
||||
if (is.character(features)) {
|
||||
|
||||
Reference in New Issue
Block a user