| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/xgb.DMatrix.R |
| 3 |
\name{dimnames.xgb.DMatrix} |
| 4 |
\alias{dimnames.xgb.DMatrix} |
| 5 |
\alias{dimnames<-.xgb.DMatrix} |
| 6 |
\title{Handling of column names of \code{xgb.DMatrix}} |
| 7 |
\usage{ |
| 8 |
\method{dimnames}{xgb.DMatrix}(x) |
| 9 |
|
| 10 |
\method{dimnames}{xgb.DMatrix}(x) <- value |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{x}{Object of class \code{xgb.DMatrix}.} |
| 14 |
|
| 15 |
\item{value}{A list of two elements: the first one is ignored |
| 16 |
and the second one is column names} |
| 17 |
} |
| 18 |
\description{ |
| 19 |
Only column names are supported for \code{xgb.DMatrix}, thus setting of |
| 20 |
row names would have no effect and returned row names would be \code{NULL}. |
| 21 |
} |
| 22 |
\details{ |
| 23 |
Generic \code{\link[=dimnames]{dimnames()}} methods are used by \code{\link[=colnames]{colnames()}}. |
| 24 |
Since row names are irrelevant, it is recommended to use \code{\link[=colnames]{colnames()}} directly. |
| 25 |
} |
| 26 |
\examples{ |
| 27 |
data(agaricus.train, package = "xgboost") |
| 28 |
|
| 29 |
train <- agaricus.train |
| 30 |
dtrain <- xgb.DMatrix(train$data, label = train$label, nthread = 2) |
| 31 |
dimnames(dtrain) |
| 32 |
colnames(dtrain) |
| 33 |
colnames(dtrain) <- make.names(1:ncol(train$data)) |
| 34 |
print(dtrain, verbose = TRUE) |
| 35 |
|
| 36 |
} |