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/RtmpPJeNgk/prediction.json"
dir(saveLoc)
#> [1] "bslib-c7d4768fab3337917a08cb2ed353c0e3"
#> [2] "downlit"
#> [3] "file20b113599418"
#> [4] "file20b11919e71c.sqlite"
#> [5] "file20b11980aca4.sqlite"
#> [6] "file20b11c4f4c90.sqlite"
#> [7] "file20b11cd9e07f"
#> [8] "file20b122df1cce.sqlite"
#> [9] "file20b126e344c3.sqlite"
#> [10] "file20b128075cf6.sqlite"
#> [11] "file20b12a54b69.sqlite"
#> [12] "file20b132c6b883.sqlite"
#> [13] "file20b13f4ea49b.sqlite"
#> [14] "file20b142efa498.sqlite"
#> [15] "file20b14a7f0307.sqlite"
#> [16] "file20b152039b72"
#> [17] "file20b165282259.sqlite"
#> [18] "file20b166e71655.sqlite"
#> [19] "file20b16b0fca8b"
#> [20] "file20b16b806494.sqlite"
#> [21] "file20b1759ba368.sqlite"
#> [22] "file20b1ad2a767.sqlite"
#> [23] "prediction.json"
#> [24] "temp_libpath20b1424d729a"
# clean up
unlink(file.path(saveLoc, "prediction.json"))