saveRforce() saves a trained Rforce object to disk, including both
the R-side metadata (e.g., model settings, variable importance, parameters) and
the full C-based forest structure. The external C pointer is handled separately
and excluded from the saved .rds file to ensure portability and session
safety.
Arguments
- forest
An object of class
"Rforce"representing the fitted random survival forest.- file
A character string specifying the directory path where the object should be saved. The directory will be created by the underlying C routine if it does not already exist.
- ...
Additional arguments passed to
saveRDS(), such ascompressorversion.
Value
Invisibly returns NULL. A message is not printed, but files are written
to the specified directory.
Details
The function performs the following actions:
Calls the native routine
R_SaveRforceto serialize and write the forest structure (all trees) to the specified directory.Removes the external C pointer (
_external_forest_C_Ptr) from the R object to prevent session-specific pointer issues.Saves the remaining R-side object to
Rforce.rdsusingsaveRDS().
The resulting directory structure is compatible with loadRforce(), which
restores both the R object and its native forest pointer.
See also
loadRforce to reload a saved Rforce object.