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/Rtmpox5Ykh/prediction.json"
dir(saveLoc)
#> [1] "bslib-c7d4768fab3337917a08cb2ed353c0e3"
#> [2] "downlit"
#> [3] "file22a316967cd1.sqlite"
#> [4] "file22a328ff8f41"
#> [5] "file22a337cad46"
#> [6] "file22a33fcc3bef.sqlite"
#> [7] "file22a349b23ba7"
#> [8] "file22a34b61ec8e"
#> [9] "file22a34b91356f.sqlite"
#> [10] "file22a35360e9cf.sqlite"
#> [11] "file22a358439d9d.sqlite"
#> [12] "file22a36236357e.sqlite"
#> [13] "file22a36a55ba1a.sqlite"
#> [14] "file22a36b10e684.sqlite"
#> [15] "file22a36f76e711.sqlite"
#> [16] "file22a36fae1313.sqlite"
#> [17] "file22a379a7f414.sqlite"
#> [18] "file22a395a3979.sqlite"
#> [19] "file22a3b93d796.sqlite"
#> [20] "file22a3cee7480.sqlite"
#> [21] "file22a3e0c4616.sqlite"
#> [22] "file22a3fc5be91.sqlite"
#> [23] "prediction.json"
#> [24] "temp_libpath22a362bb5657"
# clean up
unlink(file.path(saveLoc, "prediction.json"))