r安装。安装下载包的软件包

时间:2022-02-14 14:14:11

I am trying to install and update packages. install.packages(ask=FALSE) downloads the packages but if there is an error, it aborts. If I run it again, it again downloads the packages. How can it check and install already downloaded packages on repeat running rather than downloading every time?

我正在尝试安装和更新包。install.packages(ask=FALSE)下载了这些包,但是如果出现错误,就会中止。如果我再次运行它,它将再次下载包。它如何在重复运行时检查和安装已经下载的包,而不是每次都下载?

I am using Debian Stable Linux with backports repository, as mentioned on : http://cran.r-project.org/bin/linux/debian/README

我正在使用带有反向存储库的Debian稳定Linux,如上面提到的:http://cran.r-project.org/bin/linux/debian/README

2 个解决方案

#1


2  

This answer is for a linux system, although I think that for windows things shouldn't be different. When you try to install a package, at the end of the process (whether successful or not), R tells you where is the downloaded package. You should see something like this:

这个答案是针对一个linux系统的,尽管我认为对于windows来说,事情应该是不一样的。当您尝试安装一个包时,在过程的末尾(无论成功与否),R会告诉您下载的包在哪里。你应该看到这样的东西:

    #The downloaded source packages are in
    #       ‘/tmp/RtmpSPFiKl/downloaded_packages’

The path may change on a case basis. R stores the source packages in a temporary folder; this means that next time you reboot, files will disappear. So, suppose that I was trying to install a package that needs some system requirements. I receive an error. Then I proceed to install the needed system packages. When I try to install the R package back, I can:

路径可能根据情况而改变。R将源包存储在临时文件夹中;这意味着下次重新启动时,文件将会消失。假设我正在安装一个需要系统需求的包。我收到一个错误。然后我继续安装所需的系统包。当我试图将R包安装回去时,我可以:

   install.packages("/tmp/RtmpSPFiKl/downloaded_packages/packagename.tar.gz",repos=NULL)

without having to download it a second time.

不用再下载一次。

#2


1  

you can use the destir parameter and set repos to NULL

您可以使用destir参数并将repos设置为NULL

install.packages("RcppEigen",destdir = '/tmp/RtmpWq9e8P/downloaded_packages',repos=NULL)

#1


2  

This answer is for a linux system, although I think that for windows things shouldn't be different. When you try to install a package, at the end of the process (whether successful or not), R tells you where is the downloaded package. You should see something like this:

这个答案是针对一个linux系统的,尽管我认为对于windows来说,事情应该是不一样的。当您尝试安装一个包时,在过程的末尾(无论成功与否),R会告诉您下载的包在哪里。你应该看到这样的东西:

    #The downloaded source packages are in
    #       ‘/tmp/RtmpSPFiKl/downloaded_packages’

The path may change on a case basis. R stores the source packages in a temporary folder; this means that next time you reboot, files will disappear. So, suppose that I was trying to install a package that needs some system requirements. I receive an error. Then I proceed to install the needed system packages. When I try to install the R package back, I can:

路径可能根据情况而改变。R将源包存储在临时文件夹中;这意味着下次重新启动时,文件将会消失。假设我正在安装一个需要系统需求的包。我收到一个错误。然后我继续安装所需的系统包。当我试图将R包安装回去时,我可以:

   install.packages("/tmp/RtmpSPFiKl/downloaded_packages/packagename.tar.gz",repos=NULL)

without having to download it a second time.

不用再下载一次。

#2


1  

you can use the destir parameter and set repos to NULL

您可以使用destir参数并将repos设置为NULL

install.packages("RcppEigen",destdir = '/tmp/RtmpWq9e8P/downloaded_packages',repos=NULL)