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/Rtmpb7S9Xv/prediction.json"
dir(saveLoc)
#> [1] "bslib-0283b6b1e00c5c093bb7ba6e996bedd7"
#> [2] "downlit"
#> [3] "file24a61a06d551.duckdb"
#> [4] "file24a61a06d551.duckdb.wal"
#> [5] "file24a61b890e8b.duckdb"
#> [6] "file24a61b890e8b.duckdb.wal"
#> [7] "file24a62cb773e5"
#> [8] "file24a63f465019"
#> [9] "file24a64351d94c.duckdb"
#> [10] "file24a64351d94c.duckdb.wal"
#> [11] "file24a643782a98"
#> [12] "file24a64ddd79c2"
#> [13] "file24a67910ae57.duckdb"
#> [14] "prediction.json"
#> [15] "temp_libpath24a6a08cfc3"
# clean up
unlink(file.path(saveLoc, "prediction.json"))