You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何正确从CRAN归档安装已移除的R包frailtySurv

如何正确从CRAN归档安装已移除的R包frailtySurv

Hi David, let's work through this together—your attempts were close, but there were small missteps causing the issues. Here's how to get frailtySurv installed properly:

Why your previous methods didn't work

  • The zip file approach: R expects source packages in .tar.gz format, not manually zipped folders. When you extracted the original .tar.gz and re-zipped it, you likely messed up the package directory structure that R uses to recognize and load the package. That's why it said "installed successfully" but library(frailtySurv) failed.
  • The direct repos URL approach: The repos parameter needs to point to a valid CRAN repository root (which has a package index file), not the specific subfolder for an archived package. That's why you got the "unable to access index for repository" error.

First, make sure you have the devtools package installed (it simplifies installing packages from URLs):

install.packages("devtools")

Then use devtools::install_url() to install the specific archived version. Replace the path in the quotes with the exact link to the .tar.gz file you want (e.g., version 1.3.7):

devtools::install_url("https://cran.r-project.org/src/contrib/Archive/frailtySurv/frailtySurv_1.3.7.tar.gz")

Method 2: Manual download + local installation

If you prefer not to use devtools, you can do this manually:

  1. Go to the CRAN archive page for frailtySurv and download the .tar.gz file you want (e.g., frailtySurv_1.3.7.tar.gz) to your computer.
  2. Use install.packages() with the local file path, making sure to specify type="source" (since this is a source package):
# Replace the path with where you saved the file on your computer
install.packages("~/Downloads/frailtySurv_1.3.7.tar.gz", repos = NULL, type = "source")

Important note for compilation dependencies

Since this is a source package, you'll need compilation tools installed on your system:

  • Windows: Install Rtools (make sure it's added to your system PATH during installation).
  • Mac: Install Xcode Command Line Tools (run xcode-select --install in Terminal).
  • Linux: Install the necessary build-essential packages (e.g., sudo apt-get install r-base-dev on Debian/Ubuntu).

Once the installation finishes successfully, you should be able to load the package with library(frailtySurv) without issues.

备注:内容来源于stack exchange,提问作者David Zucker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 10:34:34