R包安装失败居然真的是版本问题

2021-10-12 12:10:57 浏览数 (1)

交流群有人询问一个包(oncoPredict)的安装问题,说是R版本问题,需要 大于4.1.0。

我下意识的认为他应该是有其它错误,但是看大家在群里讨论的热火朝天, 我就去试了试。首先看了看最原始的安装方式:

代码语言:javascript复制
> install.packages("oncoPredict")
Warning in install.packages :
  package ‘oncoPredict’ is not available (for R version 4.0.2)

确实是失败了,然后去 官网查看:https://cran.r-project.org/web/packages/oncoPredict/index.html ,果然是其DESCRIPTION 文件里面的R版本依赖 Depends: R (≥ 4.1.0) ,如下所示:

代码语言:javascript复制
oncoPredict: Drug and Biomarker Discovery
Bridges in vitro drug screening with in vivo drug and biomarker discovery. Specifically, predicts in vivo or cancer patient drug response and biomarkers to enrich for response from cell line screening data. Builds model using ridge regression, and enables biomarker discovery by imputing drug response in large cancer molecular datasets. It also enables drug specific biomarker identification by correcting for general level of drug sensitivity shared among the population.

Version: 0.2
Depends: R (≥ 4.1.0)

哪怕是下载源代码进行安装,也是绕不过去这个版本依赖 :

代码语言:javascript复制
> install.packages('oncoPredict_0.2.tar.gz',repos=NULL, type="source")
ERROR: this R is version 4.0.2, package 'oncoPredict' requires R >=  4.1.0
Warning in install.packages :
  installation of package ‘oncoPredict_0.2.tar.gz’ had non-zero exit status

但是可以把 oncoPredict_0.2.tar.gz 解压,进入 oncoPredict 文件夹 修改 DESCRIPTION 文件里面的R版本依赖 ,然后:

代码语言:javascript复制
> install.packages('oncoPredict',repos=NULL, type="source")
ERROR: dependencies 'ridge', 'pls', 'gdata' are not available for package ‘oncoPredict’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/oncoPredict’
Warning in install.packages :
  installation of package ‘oncoPredict’ had non-zero exit status

虽然这次仍然是报错了,但是这个很容易解决,仅仅是缺几个依赖包而已,解决方案如下所示:

代码语言:javascript复制
lapply(c('ridge', 'pls', 'gdata' ), install.packages)

然后就成功啦:

代码语言:javascript复制
> install.packages('oncoPredict',repos=NULL, type="source")
* installing *source* package ‘oncoPredict’ ...
file ‘DESCRIPTION’ has the wrong MD5 checksum
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (oncoPredict)

看懂这些代码,需要 有R语言基础哦:

生信基石之R语言

B站的10个小时教学视频务必看完,参考 GitHub 仓库存放的相关学习路线指导资料:https://github.com/jmzeng1314/R_bilibili ,可以参考一些优秀笔记,比如https://mubu.com/doc/2KUiSCfVsg

  • 初级10 个题目:http://www.bio-info-trainee.com/3793.html
  • 中级要求是:http://www.bio-info-trainee.com/3750.html
  • 高级要求是完成20题:http://www.bio-info-trainee.com/3415.html
  • 统计专题 30题:http://www.bio-info-trainee.com/4385.html
  • 可视化专题30题:http://www.bio-info-trainee.com/4387.html

再怎么强调生物信息学数据分析学习过程的计算机基础知识的打磨都不为过,我把它粗略的分成基于R语言的统计可视化,以及基于Linux的NGS数据处理

  • 生信分析人员如何系统入门R(2019更新版)
  • 生信分析人员如何系统入门Linux(2019更新版)

把R的知识点路线图搞定,如下:

  • 了解常量和变量概念
  • 加减乘除等运算(计算器)
  • 多种数据类型(数值,字符,逻辑,因子)
  • 多种数据结构(向量,矩阵,数组,数据框,列表)
  • 文件读取和写出
  • 简单统计可视化
  • 无限量函数学习

0 人点赞