refinement of R package
This commit is contained in:
12
R-package/R/xgb.DMatrix.save.R
Normal file
12
R-package/R/xgb.DMatrix.save.R
Normal file
@@ -0,0 +1,12 @@
|
||||
# save model or DMatrix to file
|
||||
xgb.DMatrix.save <- function(handle, fname) {
|
||||
if (typeof(fname) != "character") {
|
||||
stop("xgb.save: fname must be character")
|
||||
}
|
||||
if (class(handle) == "xgb.DMatrix") {
|
||||
.Call("XGDMatrixSaveBinary_R", handle, fname, as.integer(FALSE), PACKAGE="xgboost")
|
||||
return(TRUE)
|
||||
}
|
||||
stop("xgb.save: the input must be either xgb.DMatrix or xgb.Booster")
|
||||
return(FALSE)
|
||||
}
|
||||
Reference in New Issue
Block a user