From 8ad92934377c1ccb62d2bb5cf917052a6f72002a Mon Sep 17 00:00:00 2001 From: hetong Date: Sat, 6 Sep 2014 00:44:24 -0700 Subject: [PATCH] expose setinfo --- R-package/R/setinfo.xgb.DMatrix.R | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 R-package/R/setinfo.xgb.DMatrix.R diff --git a/R-package/R/setinfo.xgb.DMatrix.R b/R-package/R/setinfo.xgb.DMatrix.R new file mode 100644 index 000000000..0e40ab4fe --- /dev/null +++ b/R-package/R/setinfo.xgb.DMatrix.R @@ -0,0 +1,25 @@ +#' Set information of an xgb.DMatrix object +#' +#' Set information of an xgb.DMatrix object +#' +#' @examples +#' data(iris) +#' iris[,5] <- as.numeric(iris[,5]=='setosa') +#' dtrain <- xgb.DMatrix(as.matrix(iris[,1:4]), label=iris[,5]) +#' labels <- getinfo(dtrain, "label") +#' @rdname setinfo +#' @export +#' +setinfo <- function(object, ...){ + UseMethod("setinfo") +} + +#' @param object Object of class "xgb.DMatrix" +#' @param name the name of the field to get +#' @param ... other parameters +#' @rdname getinfo +#' @method getinfo xgb.DMatrix +setMethod("setinfo", signature = "xgb.DMatrix", + definition = function(object, name, info) { + xgb.setinfo(object, name, info) + })