R语言安装第三方包的方法

转载:https://biozx.top/R-install-packages.html

从CRAN(https://cran.r-project.org/) 安装第三方包的方法:

>install.packages ("coefplot")

第二种:从bioconductor安装

从bioconductor(http://www.bioconductor.org/) 安装第三方包的方法:

> source("http://bioconductor.org/biocLite.R")
> biocLite("limma")
> library(limma)

第三种:直接从Github上直接安装

直接从Github(https://github.com/) 上直接安装第三方包的方法:

  1. 安装合适版本的R软件,安装对应版本的Rtools,安装Rstudio,安装Miketex软件(这些软件均可从官网下载)。
  2. 打开R软件,选择镜像,安装“devtools”,具体可从R——程序包——安装程序包上进行,也可以使用''install.packages("devtools")'';还可以从CRAN上下载最新的程序包本地安装。(推荐最后一种)
  3. 导入devtools包:''library(devtools)''
  4. 使用''install_github("A","B")'',其中A表示要从GitHub上安装的软件包的名称,B表示开发该程序包的作者,由于install_github默认B是“hadley”(即作者是“hadley”)。举个例子,mgarch包是vst开发的,则是''install_github("mgarch","vst")''。或者''install_github("hadley/ggplot2") #(user,包)''

第四种:从源码安装

  • 先下载第三方包的安装包,

  • 然后设置安装包存放的目录为当前目录''setwd('xxxx')''

  • 然后运行''install.packages("RCurl_1.95-4.8.tar.gz",repos = NULL,type = "source")' 安装

你可能感兴趣的:(R语言安装第三方包的方法)