safe_write_csv: Save data to comma separated value files with backups

Description Usage Arguments Value Examples

View source: R/csv.R

Description

Save comma separated value files, if file exists, backup original file.

Usage

1
safe_write_csv(x, file, ..., quiet = FALSE)

Arguments

x, file, ...

pass to write.csv

quiet

whether to suppress overwrite message

Value

Normalized path of file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

raveio documentation built on Aug. 14, 2020, 5:07 p.m.