跳转至

R

1、 R 拓展包的安装

1.1、 官方在线安装

例如:安装 "ggplots" 包

S
1
2
options(CRAN="http://cran.r-project.org");
install.packages("ggplots");

1.2、 本地安装

将安装包下载到本地,然后本地安装

我一般都在这俩地址下载:

  • https://mirrors.tuna.tsinghua.edu.cn/CRAN/
  • http://bioconductor.org/

注意win下的地址的写法

S
1
install.packages("C:\\ggplot2.zip",contriburl=NULL)
1.3、 通过第三方工具在线安装(bioconductor)

S
1
2
source("http://bioconductor.org/biocLite.R")
biocLite("ggplots")
最新的 使用方法,参见: http://bioconductor.org/install/

1.4、 通过第三方工具在线安装(devtools + github)安装发布在github上的R包

例如:安装 "fishplot" 包,安装GitHub上的R包,需要指定R包的作者,一般这个包的github页面都会介绍安装的步骤

S
1
2
3
install.packages("devtools")
library(devtools)
install_github("chrisamiller/fishplot")
1.5、 github上R包的本地安装

例如:安装 "fishplot" 包, Linux 直接在命令行安装 windows需要在cmd界面安装

Bash
1
2
3
git clone git@github.com:chrisamiller/fishplot.git
R CMD build fishplot
R CMD INSTALL fishplot_0.2.tar.gz

1.6、 内网安装

https://blog.csdn.net/liu365560704/article/details/70321153

2、 常用技巧

S
1
rm(list = ls(all=TRUE))   # 清除变量