public
Created

My .Rprofile that works both on Windows and Linux

  • Download Gist
Rprofile.R
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# .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=''))
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.