Save comma separated value files, if file exists, backup original file.
Examples
f <- tempfile()
x <- data.frame(a = 1:10)
# File not exists, same as write file, returns normalized `f`
safe_write_csv(x, f)
#> [1] "/private/var/folders/2s/h6hvv9ps03xgz_krkkstvq_r0000gn/T/Rtmp64Vhbn/file1e4a167ba078"
# Check whether file exists
file.exists(f)
#> [1] TRUE
# write again, and the old file will be copied
safe_write_csv(x, f)
#> [1] "/private/var/folders/2s/h6hvv9ps03xgz_krkkstvq_r0000gn/T/Rtmp64Vhbn/file1e4a167ba078"