learner attribute setter & getter for R interface

This commit is contained in:
Vadim Khotilovich
2016-04-26 02:18:16 -05:00
parent b588479f66
commit b5fb437aa7
2 changed files with 38 additions and 0 deletions

View File

@@ -229,6 +229,27 @@ SEXP XGBoosterCreate_R(SEXP dmats) {
return ret;
}
SEXP XGBoosterGetAttr_R(SEXP handle, SEXP name) {
const char* ret;
R_API_BEGIN();
int success;
CHECK_CALL(XGBoosterGetAttr(R_ExternalPtrAddr(handle),
CHAR(asChar(name)),
&ret,
&success));
R_API_END();
return mkString(ret);
}
SEXP XGBoosterSetAttr_R(SEXP handle, SEXP name, SEXP val) {
R_API_BEGIN();
CHECK_CALL(XGBoosterSetAttr(R_ExternalPtrAddr(handle),
CHAR(asChar(name)),
CHAR(asChar(val))));
R_API_END();
return R_NilValue;
}
SEXP XGBoosterSetParam_R(SEXP handle, SEXP name, SEXP val) {
R_API_BEGIN();
CHECK_CALL(XGBoosterSetParam(R_ExternalPtrAddr(handle),