| 383 | } |
| 384 | |
| 385 | XGB_DLL SEXP XGDMatrixCreateFromMat_R(SEXP mat, SEXP missing, SEXP n_threads) { |
| 386 | SEXP ret = Rf_protect(R_MakeExternalPtr(nullptr, R_NilValue, R_NilValue)); |
| 387 | R_API_BEGIN(); |
| 388 | |
| 389 | DMatrixHandle handle; |
| 390 | int res_code; |
| 391 | { |
| 392 | auto array_str = MakeArrayInterfaceFromRMat(mat); |
| 393 | auto config_str = MakeJsonConfigForArray(missing, n_threads, TYPEOF(mat)); |
| 394 | |
| 395 | res_code = XGDMatrixCreateFromDense(array_str.c_str(), config_str.c_str(), &handle); |
| 396 | } |
| 397 | CHECK_CALL(res_code); |
| 398 | R_SetExternalPtrAddr(ret, handle); |
| 399 | R_RegisterCFinalizerEx(ret, _DMatrixFinalizer, TRUE); |
| 400 | R_API_END(); |
| 401 | Rf_unprotect(1); |
| 402 | return ret; |
| 403 | } |
| 404 | |
| 405 | XGB_DLL SEXP XGDMatrixCreateFromDF_R(SEXP df, SEXP missing, SEXP n_threads) { |
| 406 | SEXP ret = Rf_protect(R_MakeExternalPtr(nullptr, R_NilValue, R_NilValue)); |
nothing calls this directly
no test coverage detected