如何解决R的问题: package ‘survcomp’ is not available for this version of R

我在使用survcomp时,结果弄不下来,系统提示如下:

> install.packages("survcomp")
Warning in install.packages :
  package ‘survcomp’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

我顺着给出的链接进去查看问题,但好像也解决不了,百度的结果是可以直接下载源代码,但我也没搜到survcomp的源代码安装包,这个办法只好作罢。

但,有个大佬建议从BiocManager入手下载,成功结局问题,我的过程如下(包含R的结果展示):

View(R.version)  #首先看下我的R版本,似乎还比较新的,R4.3.2,据说新版本是没法直接下载survcomp的

#然后输入以下两个命令,如需更改,直接复制跑
if (!require("BiocManager", quietly = TRUE))
+   install.packages("BiocManager")   
BiocManager::install("survcomp")



#运动结果如下:下载BiocManager成功
试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.3/BiocManager_1.30.22.zip'
Content type 'application/zip' length 495739 bytes (484 KB)
downloaded 484 KB

程序包‘BiocManager’打开成功,MD5和检查也通过

下载的二进制程序包在
	C:\Users\Administrator\AppData\Local\Temp\RXXXXXXXXXXXXXXX ~~~~~~~~
'getOption("repos")' replaces Bioconductor standard repositories, see
'help("repositories", package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://mirrors.tuna.tsinghua.edu.cn/CRAN/
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 (2023-10-31 ucrt)
Installing package(s) 'BiocVersion', 'survcomp'
还安装相依关系‘SuppDists’, ‘survivalROC’, ‘bootstrap’, ‘rmeta’

试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.3/SuppDists_1.1-9.7.zip'
Content type 'application/zip' length 297057 bytes (290 KB)
downloaded 290 KB

试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.3/survivalROC_1.0.3.1.zip'
Content type 'application/zip' length 47098 bytes (45 KB)
downloaded 45 KB

试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.3/bootstrap_2019.6.zip'
Content type 'application/zip' length 117223 bytes (114 KB)
downloaded 114 KB

试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.3/rmeta_3.0.zip'
Content type 'application/zip' length 111807 bytes (109 KB)
downloaded 109 KB

试开URL’https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.3/BiocVersion_3.18.1.zip'
Content type 'application/zip' length 8320 bytes
downloaded 8320 bytes

试开URL’https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.3/survcomp_1.52.0.zip'
Content type 'application/zip' length 1125909 bytes (1.1 MB)
downloaded 1.1 MB

程序包‘SuppDists’打开成功,MD5和检查也通过
程序包‘survivalROC’打开成功,MD5和检查也通过
程序包‘bootstrap’打开成功,MD5和检查也通过
程序包‘rmeta’打开成功,MD5和检查也通过
程序包‘BiocVersion’打开成功,MD5和检查也通过
程序包‘survcomp’打开成功,MD5和检查也通过

下载的二进制程序包在
	C:\Users\Administrator\AppData\Local\Temp\RtmpGaxSBr\downloaded_packages里
Old packages: 'checkmate', 'cli', 'cluster', 'cowplot', 'cpp11', 'data.table', 'digest',
  'e1071', 'emmeans', 'fansi', 'foreign', 'future', 'future.apply', 'ggrepel', 'glue',
  'htmlwidgets', 'httpuv', 'jsonlite', 'kableExtra', 'lattice', 'lavaan', 'MASS',
  'Matrix', 'mgcv', 'nlme', 'patchwork', 'pkgload', 'ps', 'Rcpp', 'readr', 'recipes',
  'rJava', 'rlang', 'rpart', 'sandwich', 'sass', 'stringi', 'tidyr', 'timechange',
  'timeDate', 'uuid', 'vcd', 'vctrs', 'withr', 'yaml', 'zip'
Update all/some/none? [a/s/n]:  


n  #最后系统提示我是不是需要更新R的包,我选择了n
 library(survcomp)  #选择n之后,我开始加载survcomp包了
#载入需要的程辑包:survival    
#载入需要的程辑包:prodlim   系统提示我要加载这两个依赖包
#于是新的顺序是这样:
 library(survival) 
 library(prodlim) 
 library(survcomp)

#完成了


总是就是两句命令:

if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install("survcomp")

其他的结果根据系统提示来,没问题的! ?

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值