my_blog
my_blog copied to clipboard
R 启动设置
2017-04-27
在 Linux 系统中,R 启动时默认加载 ~/.Rprofile
文件,这就为自定义多种 R 选项提供了方便。
我的~/.Rprofile
文件内容:
# 设置启动时工作目录
setwd("/home/adam/Bioinformatics")
# 设置一些选项
options("pdfviewer"="evince")
options(prompt="R>", digits=4, show.signif.stars=TRUE)
options(menu.graphics=FALSE)
options(stringsAsFactors = FALSE)
# 设置默认镜像源
source("http://bioconductor.org/biocLite.R")
options(BioC_mirror="http://mirrors.ustc.edu.cn/bioc/")
options(repos=c("http://mirrors.ustc.edu.cn/CRAN/","https://mirrors.aliyun.com/CRAN/","http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
# 有用的小功能
cd <- setwd
pwd <- getwd
hh <- function(d) d[1:5,1:5]
# 经常需要的包
library("colorout")
# 加载完成后打印信息提示
message("###### SUCCESSFULLY LOADED. LET'S DO THIS! ######")