[R] enforce lintr checks (fixes #8012) (#8613)

This commit is contained in:
James Lamb
2022-12-24 15:02:56 -06:00
committed by GitHub
parent f489d824ca
commit c7e82b5914
11 changed files with 13 additions and 15 deletions

View File

@@ -273,7 +273,7 @@ xgb.shap.data <- function(data, shap_contrib = NULL, features = NULL, top_n = 1,
}
top_n <- top_n[1]
if (top_n < 1 | top_n > 100) stop("top_n: must be an integer within [1, 100]")
features <- imp$Feature[1:min(top_n, NROW(imp))]
features <- imp$Feature[seq_len(min(top_n, NROW(imp)))]
}
if (is.character(features)) {
features <- match(features, colnames(data))