Files
2026-07-13 13:27:18 +08:00

35 lines
926 B
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{dim.lgb.Dataset}
\alias{dim.lgb.Dataset}
\title{Dimensions of an \code{lgb.Dataset}}
\usage{
\method{dim}{lgb.Dataset}(x)
}
\arguments{
\item{x}{Object of class \code{lgb.Dataset}}
}
\value{
a vector of numbers of rows and of columns
}
\description{
Returns a vector of numbers of rows and of columns in an \code{lgb.Dataset}.
}
\details{
Note: since \code{nrow} and \code{ncol} internally use \code{dim}, they can also
be directly used with an \code{lgb.Dataset} object.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
stopifnot(nrow(dtrain) == nrow(train$data))
stopifnot(ncol(dtrain) == ncol(train$data))
stopifnot(all(dim(dtrain) == dim(train$data)))
}
}