R suppressing file creation commands (like dev.copy, write.csv) -
i have script in r used create files through commands write.csv
, dev.copy
. want run script compile data (in order play in r) don't want script create files. can because don't want overwrite previous files, because want keep files (like .csv
files) open, or because don't want clog directory unnecessary files. i'll call these occasions "draft" mode , other times "final" mode.
so far solutions have been to
- write such commands
write.csv(..., file = paste(timestamp, ...))
timestamp <- sys.date()
ortimestamp <- format(sys.time(), ...)
, depending on how paranoid file overwriting am. (clogs directory can useful outside of problem.) - include
setwd("~/sandbox/")
drafts. (can complex if script accesses files particular directory mid-script.) redefine file-writing commands , including menu ask me mode i'm in:
mode <- menu(c("draft", "final"), graphics=true)
# ...
my.write.csv <- function(...)if(mode == 2) write.csv(...)
but feel there might better ways. other (perhaps better) ways approach situation?
Comments
Post a Comment