| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/xgb.DMatrix.R |
| 3 |
\name{dim.xgb.DMatrix} |
| 4 |
\alias{dim.xgb.DMatrix} |
| 5 |
\title{Dimensions of xgb.DMatrix} |
| 6 |
\usage{ |
| 7 |
\method{dim}{xgb.DMatrix}(x) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{Object of class \code{xgb.DMatrix}} |
| 11 |
} |
| 12 |
\description{ |
| 13 |
Returns a vector of numbers of rows and of columns in an \code{xgb.DMatrix}. |
| 14 |
} |
| 15 |
\details{ |
| 16 |
Note: since \code{\link[=nrow]{nrow()}} and \code{\link[=ncol]{ncol()}} internally use \code{\link[=dim]{dim()}}, they can also |
| 17 |
be directly used with an \code{xgb.DMatrix} object. |
| 18 |
} |
| 19 |
\examples{ |
| 20 |
data(agaricus.train, package = "xgboost") |
| 21 |
|
| 22 |
train <- agaricus.train |
| 23 |
dtrain <- xgb.DMatrix(train$data, label = train$label, nthread = 2) |
| 24 |
|
| 25 |
stopifnot(nrow(dtrain) == nrow(train$data)) |
| 26 |
stopifnot(ncol(dtrain) == ncol(train$data)) |
| 27 |
stopifnot(all(dim(dtrain) == dim(train$data))) |
| 28 |
|
| 29 |
} |