[R] Refactor field logic for dmatrix (#9901)
This commit is contained in:
@@ -12,7 +12,7 @@ setinfo(object, ...)
|
||||
\arguments{
|
||||
\item{object}{Object of class "xgb.DMatrix"}
|
||||
|
||||
\item{...}{other parameters}
|
||||
\item{...}{Not used.}
|
||||
|
||||
\item{name}{the name of the field to get}
|
||||
|
||||
|
||||
32
R-package/man/xgb.DMatrix.hasinfo.Rd
Normal file
32
R-package/man/xgb.DMatrix.hasinfo.Rd
Normal file
@@ -0,0 +1,32 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/xgb.DMatrix.R
|
||||
\name{xgb.DMatrix.hasinfo}
|
||||
\alias{xgb.DMatrix.hasinfo}
|
||||
\title{Check whether DMatrix object has a field}
|
||||
\usage{
|
||||
xgb.DMatrix.hasinfo(object, info)
|
||||
}
|
||||
\arguments{
|
||||
\item{object}{The DMatrix object to check for the given \code{info} field.}
|
||||
|
||||
\item{info}{The field to check for presence or absence in \code{object}.}
|
||||
}
|
||||
\description{
|
||||
Checks whether an xgb.DMatrix object has a given field assigned to
|
||||
it, such as weights, labels, etc.
|
||||
}
|
||||
\examples{
|
||||
library(xgboost)
|
||||
x <- matrix(1:10, nrow = 5)
|
||||
dm <- xgb.DMatrix(x, nthread = 1)
|
||||
|
||||
# 'dm' so far doesn't have any fields set
|
||||
xgb.DMatrix.hasinfo(dm, "label")
|
||||
|
||||
# Fields can be added after construction
|
||||
setinfo(dm, "label", 1:5)
|
||||
xgb.DMatrix.hasinfo(dm, "label")
|
||||
}
|
||||
\seealso{
|
||||
\link{xgb.DMatrix}, \link{getinfo.xgb.DMatrix}, \link{setinfo.xgb.DMatrix}
|
||||
}
|
||||
Reference in New Issue
Block a user