Saves the prediction dataframe to a json file
Details
Saves the prediction data frame returned by predict.R to an json file and returns the fileLocation where the prediction is saved
Examples
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)
#> [1] "/tmp/RtmpBBYORx/prediction.json"
dir(saveLoc)
#> [1] "bslib-0283b6b1e00c5c093bb7ba6e996bedd7"
#> [2] "downlit"
#> [3] "file218b1f02c816"
#> [4] "file218b24a60e7a"
#> [5] "file218b53cf9f10"
#> [6] "file218b728aa566"
#> [7] "file218b7613afd5.duckdb"
#> [8] "file218b7613afd5.duckdb.wal"
#> [9] "file218b7b1655d5.duckdb"
#> [10] "file218b7b1655d5.duckdb.wal"
#> [11] "prediction.json"
#> [12] "temp_libpath218b18e88161"
# clean up
unlink(file.path(saveLoc, "prediction.json"))