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

  1. write such commands write.csv(..., file = paste(timestamp, ...)) timestamp <- sys.date() or timestamp <- format(sys.time(), ...), depending on how paranoid file overwriting am. (clogs directory can useful outside of problem.)
  2. include setwd("~/sandbox/") drafts. (can complex if script accesses files particular directory mid-script.)
  3. 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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -