Debian Codegraph @

man/xgb.DMatrix.hasinfo.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/xgb.DMatrix.R
3 \name{xgb.DMatrix.hasinfo}
4 \alias{xgb.DMatrix.hasinfo}
5 \title{Check whether DMatrix object has a field}
6 \usage{
7 xgb.DMatrix.hasinfo(object, info)
8 }
9 \arguments{
10 \item{object}{The DMatrix object to check for the given \code{info} field.}
11
12 \item{info}{The field to check for presence or absence in \code{object}.}
13 }
14 \description{
15 Checks whether an xgb.DMatrix object has a given field assigned to
16 it, such as weights, labels, etc.
17 }
18 \examples{
19 x <- matrix(1:10, nrow = 5)
20 dm <- xgb.DMatrix(x, nthread = 1)
21
22 # 'dm' so far does not have any fields set
23 xgb.DMatrix.hasinfo(dm, "label")
24
25 # Fields can be added after construction
26 setinfo(dm, "label", 1:5)
27 xgb.DMatrix.hasinfo(dm, "label")
28 }
29 \seealso{
30 \code{\link[=xgb.DMatrix]{xgb.DMatrix()}}, \code{\link[=getinfo.xgb.DMatrix]{getinfo.xgb.DMatrix()}}, \code{\link[=setinfo.xgb.DMatrix]{setinfo.xgb.DMatrix()}}
31 }