slice.Rd 852 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
\item{...}{other parameters (currently not used)}
16
17

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

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