slice.Rd 836 Bytes
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
4
5
6
7
8
9
10
11
12
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{slice}
\alias{slice}
\alias{slice.lgb.Dataset}
\title{Slice a dataset}
\usage{
slice(dataset, ...)

\method{slice}{lgb.Dataset}(dataset, idxset, ...)
}
\arguments{
Nikita Titov's avatar
Nikita Titov committed
13
\item{dataset}{Object of class \code{lgb.Dataset}}
Guolin Ke's avatar
Guolin Ke committed
14
15
16
17
18
19
20
21
22
23

\item{...}{other parameters (currently not used)}

\item{idxset}{a integer vector of indices of rows needed}
}
\value{
constructed sub dataset
}
\description{
Get a new \code{lgb.Dataset} containing the specified rows of
Nikita Titov's avatar
Nikita Titov committed
24
original \code{lgb.Dataset} object
Guolin Ke's avatar
Guolin Ke committed
25
26
27
28
29
30
31
32
}
\examples{
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)

dsub <- lightgbm::slice(dtrain, 1:42)
33
lgb.Dataset.construct(dsub)
Guolin Ke's avatar
Guolin Ke committed
34
35
36
labels <- lightgbm::getinfo(dsub, "label")

}