Dear R-Helpers, I'm fiddling with my .Rprofile in Windows XP & R 2.7.0 Beta. I prefer to manually save my workspace but automatically save my command history via the .Rprofile. That is working fine once I found that "utils::" was required before the loadhistory & savehistory functions. What I would like to do is add a separator line with a date between the histories of each session. Something like,
=====History for Sun Apr 13 09:43:50 2008 Is this possible? I have it print the date at startup, but that doesn't appear as part of the history. Also, I'm loading two packages at startup, which is working fine with this code: local({ myOriginal <- getOption("defaultPackages") myAutoLoads <- c("Hmisc","ggplot2") myBoth <- c(myOriginal,myAutoLoads) options(defaultPackages = myBoth) }) But when reading AITR, I noticed it has a .Rprofile example that looks much simpler. It just loads the one additional package without checking the defaultPackages. Is this just as good? Does it even need to be in the .First function definition, or could it simply be a command by itself in .Rprofile? .First <- function() { options(prompt="$ ", continue="+\t") # $ is the prompt options(digits=5, length=999) # custom numbers and printout x11() # for graphics par(pch = "+") # plotting character source(file.path(Sys.getenv("HOME"), "R", "mystuff.R")) # my personal functions library(MASS) # attach a package } Thanks, Bob My whole .Rprofile: # Startup Settings # Place any R commands below. options(width=64, digits=5, show.signif.stars=TRUE) set.seed(1234) setwd("/myRfolder") myPackages <- c("car","foreign","hexbin", "ggplot2","gmodels","gplots", "Hmisc", "lattice", "reshape","ggplot2","Rcmdr") utils::loadhistory(file = "myCumulative.Rhistory") # Load packages automatically below. local({ myOriginal <- getOption("defaultPackages") # Edit next line to include your favorites. myAutoLoads <- c("Hmisc","ggplot2") myBoth <- c(myOriginal,myAutoLoads) options(defaultPackages = myBoth) }) # Things put here are done first. .First <- function() { cat("\n Welcome to R!") cat("\n " , paste(date()), "\n\n" ) } # Things put here are done last. .Last <- function() { graphics.off() cat("\n\n myCumulative.Rhistory has been saved on " ,paste(date()) ) cat("\n\n Goodbye!\n\n") utils::savehistory(file="myCumulative.Rhistory") } ========================================================= Bob Muenchen (pronounced Min'-chen), Manager Statistical Consulting Center U of TN Office of Information Technology 200 Stokely Management Center, Knoxville, TN 37996-0520 Voice: (865) 974-5230 FAX: (865) 974-4810 Email: [EMAIL PROTECTED] Web: http://oit.utk.edu/scc, News: http://listserv.utk.edu/archives/statnews.html ========================================================= ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.