2019年5月9日木曜日

.Last <- function()






restore working image in the parent directory with the name "YYYY-MM-DD-HH:MM:SS". the smaple above is 17:00:50 of May 09, 2019.

$pwd
/Users/honomoto/R_proj
$ls
2019-05-09-17:00:50  startup.R           tmp1                work
R                   startup.R~          tmp2

.Last <- function() {
  # save.image(file=paste(getwd(),Sys.time(),sep="/"))
  #
  # save working image in the parent directory. expected the length of the directory name is fixed.
  #
  save.image(file=gsub(" ","-",paste(substr(getwd(),1,22),Sys.time(),sep="/")))
  # 
  # OR store working image at the working directory
  #
  # save.image(file=gsub(" ","-",paste(getwd(),Sys.time(),sep="/")))
  cat("bye bye...\n")
}

0 件のコメント: