f <- tempfile()
x <- data.frame(a = 1:10)
# File not exists, same as write file, returns normalized `f`
safe_write_csv(x, f)
# Check whether file exists
file.exists(f)
# write again, and the old file will be copied
safe_write_csv(x, f)
Run the code above in your browser using DataLab