Skip to content

Instantly share code, notes, and snippets.

@jbryer
Created March 7, 2012 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbryer/1994111 to your computer and use it in GitHub Desktop.
Save jbryer/1994111 to your computer and use it in GitHub Desktop.
My .Rprofile that works both on Windows and Linux
# .Rprofile -- commands in this file will be executed at the beginning of
# each R session. On Windows, the R_PROFILE environment variable must have value
# with the full path to this file. On Linux (or other Unix like systems) this file
# must be in the user's home directory.
# Set the default repository to the main CRAN site
options(repos=c(CRAN='http://cran.r-project.org'))
# Set the oDrive varaible and library path
if(Sys.info()['sysname'] == 'Windows') {
oDrive = 'o:/'
.libPaths(paste(oDrive, 'R/library/Windows', sep=''))
require(utils, quietly=TRUE)
print("Setting memory limit for R to 4GB...")
memory.limit(size=4095) #Set to 4GB (for 64-bit Windows, this can be much larger)
message(paste('R_LIBS: ', Sys.getenv('R_LIBS'), sep=''))
message(paste('R_PROFILE: ', Sys.getenv('R_PROFILE'), sep=''))
} else if(Sys.info()['sysname'] == 'Linux') {
oDrive = '/n01/OutcomesAssessment/'
.libPaths(paste(oDrive, 'R/library/Linux', sep=''))
} else if(Sys.info()['sysname'] == 'Darwin') {
oDrive = NULL
}
# Customize the default look and feel of ggplot2
if(require(ggplot2, quietly=TRUE)) {
theme_update(panel.background=theme_blank(),
panel.grid.major=theme_blank(),
panel.border=theme_blank())
}
# On Linux we will alter the default behavior of the makeR package.
if(Sys.info()['sysname'] == 'Linux') {
if(require(makeR, quietly=TRUE)) {
setAutoOpen(FALSE)
setDefaultBuilder(builder.rnw.native)
}
}
# Change the location of the SQL repository
if(require(irutils, quietly=TRUE)) {
setSQLRepos(paste(oDrive, 'R/ecir/data', sep=''))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment