Learn R Programming

PatientLevelPrediction (version 6.4.1)

savePrediction: Saves the prediction dataframe to a json file

Description

Saves the prediction dataframe to a json file

Usage

savePrediction(prediction, dirPath, fileName = "prediction.json")

Value

                       The file location where the prediction was saved

Arguments

prediction

The prediciton data.frame

dirPath

The directory to save the prediction json

fileName

The name of the json file that will be saved

Details

Saves the prediction data frame returned by predict.R to an json file and returns the fileLocation where the prediction is saved

Examples

Run this code
prediction <- data.frame(
  rowIds = c(1, 2, 3),
  outcomeCount = c(0, 1, 0),
  value = c(0.1, 0.9, 0.2)
)
saveLoc <- file.path(tempdir())
savePrediction(prediction, saveLoc)
dir(saveLoc)

# clean up
unlink(file.path(saveLoc, "prediction.json"))

Run the code above in your browser using DataLab