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/RtmpFw4fKJ/prediction.json"
dir(saveLoc)
#> [1] "bslib-0283b6b1e00c5c093bb7ba6e996bedd7"
#> [2] "downlit"
#> [3] "file246b115a4f47"
#> [4] "file246b360e96d3.duckdb"
#> [5] "file246b3b800ddc"
#> [6] "file246b41cd48f2.duckdb"
#> [7] "file246b41cd48f2.duckdb.wal"
#> [8] "file246b4761fdb0.duckdb"
#> [9] "file246b4761fdb0.duckdb.wal"
#> [10] "file246b54895891.duckdb"
#> [11] "file246b54895891.duckdb.wal"
#> [12] "file246b59e37171.duckdb"
#> [13] "file246b59e37171.duckdb.wal"
#> [14] "file246b5e24d265.duckdb"
#> [15] "file246b5e24d265.duckdb.wal"
#> [16] "file246b6e943eb2.duckdb"
#> [17] "file246b6e943eb2.duckdb.wal"
#> [18] "file246b7b0c3411.duckdb"
#> [19] "file246b7b0c3411.duckdb.wal"
#> [20] "file246b89d6a12"
#> [21] "file246ba128e8b"
#> [22] "prediction.json"
#> [23] "temp_libpath246b1b02119"
# clean up
unlink(file.path(saveLoc, "prediction.json"))