# Load in data sets:
data("datlist", package = "csmpv")
tdat = datlist$training
vdat = datlist$validation
# The function saves files locally. You can define your own temporary directory.
# If not, tempdir() can be used to get the system's temporary directory.
temp_dir = tempdir()
# As an example, let's define Xvars, which will be used later:
Xvars = c("highIPI", "B.Symptoms", "MYC.IHC", "BCL2.IHC", "CD10.IHC", "BCL6.IHC")
# For given time-to-event outcome and Xvars, we can build up a binary risk classification:
xgobj = XGpred(data = tdat, varsIn = Xvars,
time = "FFP..Years.",
event = "Code.FFP", outfile = paste0(temp_dir, "/XGpred"))
tdat$XGpred_class = xgobj$XGpred_prob_class
# You might save the files to the directory you want.
# Now, we can predict the risk classification for a new data set:
xgNew = XGpred_predict(newdat = vdat, XGpredObj = xgobj)
#' # To delete the "temp_dir", use the following:
unlink(temp_dir)
Run the code above in your browser using DataLab