options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
if(! require("devtools")) install.packages("devtools")
if(! require("reshape2")) install.packages("reshape2")
if(! require("ggplot2")) install.packages("ggplot2")
if(! require("pheatmap")) install.packages("pheatmap")
if(! require("ggfortify")) install.packages("ggfortify")
if(! require("stringr")) install.packages("stringr")
if(! require("survival")) install.packages("survival")
if(! require("survminer")) install.packages("survminer")
if(! require("lars")) install.packages("lars")
if(! require("glmnet")) install.packages("glmnet") if(! require("timeROC")) install.packages("timeROC")
if(! require("ggpubr")) install.packages("ggpubr") if(! require("randomForest")) install.packages("randomForest")
if(! require("ROCR")) install.packages("ROCR")
if(! require("Hmisc")) install.packages("Hmisc") if(! require("caret")) install.packages("caret")
# if(! require("genefilter")) install.packages("genefilter")
if(! require("ggstatsplot")) install.packages("ggstatsplot") ### 下面的包是为了临床三线表
if(! require("tableone")) install.packages("tableone")
## 网络不好,就不要安装了。
## 而且Windows电脑安装 rJava 也经常是需要人指导的。
# https://github.com/rstudio/rstudio/issues/2254
if(! require("rJava")) install.packages("rJava")
if(require('rJava')){ # https://cran.r-project.org/src/contrib/Archive/ReporteRs/
if(! require("ReporteRs")) install.packages("ReporteRs")
devtools::install_github('davidgohel/ReporteRsjars')
devtools::install_github('davidgohel/ReporteRs')
} library(devtools)
source("http://bioconductor.org/biocLite.R")
## 如果你的网络实在是太差,试试看:
# install.packages("BiocInstaller",repos="http://bioconductor.org/packages/3.7/bioc")
## 很可惜你在中国大陆,不得不承受这个痛苦。 options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
library('BiocInstaller')
if(! require('edgeR')){ biocLite(c('airway','DESeq2','edgeR','limma'))
} if(! require("CLL")) biocLite("CLL")
if(! require("org.Hs.eg.db")) biocLite('org.Hs.eg.db')
library(BiocInstaller)
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
if(! require("maftools")) biocLite("maftools")
if(! require("RTCGA")) biocLite("RTCGA")
if(! require("RTCGA.clinical")) biocLite("RTCGA.clinical")
# https://bioconductor.org/packages/3.6/data/experiment/src/contrib/RTCGA.clinical_20151101.8.0.tar.gzn
if(! require("RTCGA.miRNASeq")) biocLite("RTCGA.miRNASeq")
if(! require("maftools")) biocLite("maftools")
if(! require("genefilter")) biocLite("genefilter") # Then from : https://github.com/ShixiangWang
# You don't need run the codes below, I will explain to you face to face. source("http://bioconductor.org/biocLite.R")
packs = c("devtools", "reshape2", "ggplot2", "pheatmap", "ggfortify", "stringr", "survival",
"survminer", "lars", "glmnet", "timeROC", "ggpubr", "randomForest", "ROCR", "genefilter",
"Hmisc", "caret", "airway","DESeq2","edgeR","limma", "CLL", "org.Hs.eg.db", "maftools")
if(! require(pacman)) install.packages("pacman", dependencies = TRUE)
pacman::p_load(packs, dependencies=TRUE, character.only = TRUE)
# check
pacman::p_loaded(packs, character.only = TRUE)
all(pacman::p_loaded(packs, character.only = TRUE))

注:本文转自“生信技能树”

https://mp.weixin.qq.com/s?__biz=MzAxMDkxODM1Ng==&mid=2247487157&idx=1&sn=0540a2788eba7b5a96a6d4f907d92718&chksm=9b484e0eac3fc71864f0e1d5959ac5f768bd3289312c2d0776cbe663a888edd056b092175d5c&mpshare=1&scene=23&srcid=0809lYoGGKt6uOM4j8rCH40P#rd

R包安装的正确方式的更多相关文章

  1. Linux环境下R和R包安装及其管理

    前言 R对windows使用很友好,对Linux来说充满了敌意.小数据可以在windows下交互操作,效果很好很棒.可是当我们要处理大数据,或者要在集群上搭建pipeline时,不得不面对在Linux ...

  2. 如何将R包安装到自定义路径

    参考  设置环境变量R_LIBS将R包安装到自定义路径   实际上是可以解决问题的, #环境变量完成以后,启动(重启)R,运行 .libPaths() 加载R包时,发现路径仍然未变成自定义的. 那么参 ...

  3. R 包安装、载入和卸载

    生物上的一些包可以这样安装 source("https://bioconductor.org/biocLite.R") biocLite("affy") 一般的 ...

  4. R 包 安装 卸载 查看版本

    R 查看包的版本 version> packageVersion("snow") 卸载包remove.packages 从源码安装包install.packages(path ...

  5. R包安装失败failed to download mirrors file

    在R console中使用install.packages()来安装第三方包时,会出现这样的错误: 即使我们选择的是China的镜像也解决不了问题. 这时候,可以先试试用IE打开上图中黑底部分的URL ...

  6. CAC的Debian-8-64bit安装BBR正确方式是?

    裝过三台debian 64 bit, CAC, 2歐, KVM虛擬機 做法都一樣 0. 有裝銳速記得先刪除, 免得換核心後, 銳速在扯後腿 1.換4.9版kernel 有正式版 別裝啥rc版, 4.9 ...

  7. Linux 安装R包

    https://www.cnblogs.com/jessepeng/p/10984983.html Linux 的R环境,可以通过anaconda jupyter notbook很容易的配置,见我之前 ...

  8. R包开发过程记录

    目的 走一遍R包开发过程,并发布到Github上使用. 步骤 1. 创建R包框架 Rsutdio --> File--> New Project--> New Directory - ...

  9. [Linux系统] (3)应用安装方式详解(编译安装、rpm包安装、yum安装)

    软件的安装方式: 编译安装 RPM包安装 yum安装 一.编译安装 1.下载一个源码安装包:tengine-2.3.0.tar.gz.这是淘宝二次开发过的nginx.将其解压. .tar.gz 2.查 ...

随机推荐

  1. with admin option /with grant option

    1. with admin option是用在系统权限上的,with grant option是用在对象权限上的. SQL> grant create synonym to scott with ...

  2. Eigen学习之Array类

    Eigen 不仅提供了Matrix和Vector结构,还提供了Array结构.区别如下,Matrix和Vector就是线性代数中定义的矩阵和向量,所有的数学运算都和数学上一致.但是存在一个问题是数学上 ...

  3. JWT能够干什么,不应该干什么?

    http://cryto.net/~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions/ At the start of this article ...

  4. 数据契约(DataContract)里的DataMember特性

      数据契约(DataContract) 服务契约定义了远程访问对象和可供调用的方法,数据契约则是服务端和客户端之间要传送的自定义数据类型. 一旦声明一个类型为DataContract,那么该类型就可 ...

  5. Linux装python3

     记住下载的软件最好装在/opt下默认的 大家都这样做 linux装python3.7我们以安装最新的来做测试 先下载关联的包防止出错 安装python前的库环境,非常重要yum install gc ...

  6. iOS系统声音列表

    iOS系统声音列表 效果 说明 1. 点击cell就能发出声音 2. 只需要给出声音编号,就可以,非常简单易用 源码 https://github.com/YouXianMing/iOS-Utilit ...

  7. spine获取骨骼位置

    time: 2015/07/23 版本: /****************************************************************************** ...

  8. Android点击事件

    Android点击事件 备注 全局实现View.OnClickListener 或许需要将MainActivity设置为public 注册事件 btn_login.setOnClickListener ...

  9. AT89S52之串行异步通信笔记

    SRF 中断入口地址 中断源 外中断 外部中断0 INT0(P3.2) 外部中断1 INT1(P3.3) 电平方式触发 低电平 脉冲方式触发 脉冲后延的负跳 内中断 定时中断 串行中断 中断允许控制寄 ...

  10. November 22nd 2016 Week 48th Tuesday

    Eventually, you will learn to cry on the inside. 终有一天,你得学会让眼泪在心里流. Cry on the inside. I am tired, an ...