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/95/0ydz4d79163427j3k5crp3fh0000gn/T/RtmpN1XDVO/file17ff4b5623fd"
# 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/95/0ydz4d79163427j3k5crp3fh0000gn/T/RtmpN1XDVO/file17ff4b5623fd"