I'm trying to customize my R setup. I understood the part where we can put our functions(.First/Last) in Rprofile.site
or .Rprofile
. but I want to take .Rdata
route. As I understand that if I have a .First/.Last function in any of the .R file in my working directory. Then when I open my .Rdata
file my custom setting should be loaded.
Though I get an Adios when I quit the session but I don't get anything when I open my .Rdata
. Anyway, below are my .First and .Last function.
.First <- function() {
options(prompt="$ ", continue="+\t") # $ is the prompt
options(digits=5, length=999)
cat(paste(date(),"\nWelcome\n"))
# custom numbers and printout
x11() # for graphics
par(pch = "+")
# my personal functions
library(cluster) # attach a package
s <- base::summary
h <- utils::head
n <- base::names
}
.Last <- function() {
graphics.off() # a small safety measure.
cat(paste(date(),"\nAdios\n")) # Is it time for lunch?
}