dimnames.lgb.Dataset.Rd 1.14 KB
Newer Older
Guolin Ke's avatar
Guolin Ke committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lgb.Dataset.R
\name{dimnames.lgb.Dataset}
\alias{dimnames.lgb.Dataset}
\alias{dimnames<-.lgb.Dataset}
\title{Handling of column names of \code{lgb.Dataset}}
\usage{
\method{dimnames}{lgb.Dataset}(x)

\method{dimnames}{lgb.Dataset}(x) <- value
}
\arguments{
\item{x}{object of class \code{lgb.Dataset}}

\item{value}{a list of two elements: the first one is ignored
and the second one is column names}
}
18
19
20
\value{
A list with the dimension names of the dataset
}
Guolin Ke's avatar
Guolin Ke committed
21
22
\description{
Only column names are supported for \code{lgb.Dataset}, thus setting of
23
             row names would have no effect and returned row names would be NULL.
Guolin Ke's avatar
Guolin Ke committed
24
25
26
27
28
29
}
\details{
Generic \code{dimnames} methods are used by \code{colnames}.
Since row names are irrelevant, it is recommended to use \code{colnames} directly.
}
\examples{
30
\donttest{
Guolin Ke's avatar
Guolin Ke committed
31
32
33
34
35
36
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
lgb.Dataset.construct(dtrain)
dimnames(dtrain)
colnames(dtrain)
37
colnames(dtrain) <- make.names(seq_len(ncol(train$data)))
Guolin Ke's avatar
Guolin Ke committed
38
print(dtrain, verbose = TRUE)
39
}
Guolin Ke's avatar
Guolin Ke committed
40
}