[R] fix uses of 1:length(x) and other small things (#5992)

This commit is contained in:
James Lamb
2020-08-08 20:31:33 +01:00
committed by GitHub
parent 801e6b6800
commit 589b385ec6
7 changed files with 15 additions and 15 deletions

View File

@@ -357,7 +357,7 @@ slice.xgb.DMatrix <- function(object, idxset, ...) {
#' @export
print.xgb.DMatrix <- function(x, verbose = FALSE, ...) {
cat('xgb.DMatrix dim:', nrow(x), 'x', ncol(x), ' info: ')
infos <- c()
infos <- character(0)
if (length(getinfo(x, 'label')) > 0) infos <- 'label'
if (length(getinfo(x, 'weight')) > 0) infos <- c(infos, 'weight')
if (length(getinfo(x, 'base_margin')) > 0) infos <- c(infos, 'base_margin')