Skip to content

Instantly share code, notes, and snippets.

@adamsardar
Last active January 8, 2021 09:37
Show Gist options
  • Save adamsardar/e8e1d99ea07f837a6336a2fe2184e3b5 to your computer and use it in GitHub Desktop.
Save adamsardar/e8e1d99ea07f837a6336a2fe2184e3b5 to your computer and use it in GitHub Desktop.
My standard Rprofile
#Including arch is useful for times that one might be running two versions of R on different architectures. e.g. on new M1 Macs
libDirectory <- paste(c("~/Rlibs/", R.Version()$minor, "/", R.Version()$arch, "/"),collapse="")
.libPaths(libDirectory)
#Taken from bioconductor. This removes the need for using biocLite to install packages, which would be at the top of my list of "Bad Things About R"
biocVersion <- "3.12"
biocMirror <- getOption("BioC_mirror", "https://bioconductor.org")
biocPaths <- c(BioCsoft = "bioc", BioCann = "data/annotation", BioCexp = "data/experiment")
biocRepos <- structure(paste(biocMirror, "packages", biocVersion, biocPaths, sep = "/"), names = names(biocPaths) )
options(
repos = c(CRAN = "https://cran.rstudio.com",
biocRepos),
download.file.method = "libcurl")
# Use `export R_LOAD_PACKAGES="FALSE"` to skip loading packages
if(Sys.getenv("R_LOAD_PACKAGES") != "FALSE"){
suppressPackageStartupMessages({
## Change colors when running R in the terminal
if (isatty(stdout())){ if(require("colorout")){ setOutputColors256(verbose=FALSE) } }
if(require(data.table)){
options("datatable.print.class"= TRUE)
setDTthreads(6)
}
require(ggplot2)
require(magrittr)
require(stringr)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment