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/RtmpLm2zJP/prediction.json"
dir(saveLoc)
#> [1] "bslib-0283b6b1e00c5c093bb7ba6e996bedd7"
#> [2] "downlit"
#> [3] "file25a1143d0166.duckdb"
#> [4] "file25a1143d0166.duckdb.wal"
#> [5] "file25a1177d5160"
#> [6] "file25a12713bf0b.duckdb"
#> [7] "file25a12713bf0b.duckdb.wal"
#> [8] "file25a129a41459.duckdb"
#> [9] "file25a129a41459.duckdb.wal"
#> [10] "file25a135260ab3"
#> [11] "file25a14fdb0180.duckdb"
#> [12] "file25a153aa466b"
#> [13] "file25a1587a3249"
#> [14] "prediction.json"
#> [15] "temp_libpath25a17835259f"
# clean up
unlink(file.path(saveLoc, "prediction.json"))