我想直接从包源的URL安装包.我想这样做是为了让人们可以轻松测试不应广泛(或永久)可用的预发布版本的软件包. 这是一个类似的问题,但它有所不同,因为它只描述了如何从本地文件安装而不是一般URL.
为了这个问题,我将使用boot包源的链接.?install.packages特别是阅读pkgs论证的描述表明:
install.packages(
"http://cran.r-project.org/src/contrib/Archive/boot/boot_1.3-7.tar.gz",
repos = NULL, type = "source"
)
Run Code Online (Sandbox Code Playgroud)
然而,这失败了:
Warning in install.packages :
installation of package
‘http://cran.r-project.org/src/contrib/Archive/boot/boot_1.3-7.tar.gz’
had non-zero exit status
Run Code Online (Sandbox Code Playgroud)
建议将URL解释为包名称,而不是其位置.我们可以通过以下两步程序来解决这个问题:
download.file(
"http://cran.r-project.org/src/contrib/Archive/boot/boot_1.3-7.tar.gz",
"boot"
)
install.packages("boot", repos = NULL, type = "source")
Run Code Online (Sandbox Code Playgroud)
但我更愿意install.packages只用一次电话就可以做到这一点; 因为install.packages无论如何能够下载文件我觉得这应该是可能的.
我刚刚创建了一个package(RTIO)和一个package repository(Q:/Integrated Planning/R),它是一个公司网络驱动器.
我把我的包装到文件夹中:
Q:/Integrated Planning/R/bin/windows/contrib/2.15/RTIO_0.1-2.zip
根据Dirk在此 SO中的说明,我运行以下命令:
> setwd("Q:/Integrated Planning/R/bin/windows/contrib/2.15")
> tools::write_PACKAGES(".", type="win.binary")
> list.files()
[1] "PACKAGES" "PACKAGES.gz" "RTIO_0.1-2.zip"
>
Run Code Online (Sandbox Code Playgroud)
使用下面的代码,我已将本地存储库添加到我的repos列表中(我将让其他用户也这样做):
options(repos = c(getOption("repos"), RioTintoIronOre = "Q:/Integrated Planning/R"))
Run Code Online (Sandbox Code Playgroud)
现在尝试安装我的包我收到一个错误:
> install.packages("RTIO")
Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15
Warning in install.packages :
unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15
Warning in install.packages :
unable to access index for repository …Run Code Online (Sandbox Code Playgroud) R.的新手如何访问和编辑Rprofile?
以下帖子没有帮助:如何在Windows下修改和保存Rprofile.site?
我正在试图弄清楚如何创建一个http CRAN-repository.我试图跟随本地CRAN存储库,但没有取得真正的成功.
基本上我有这样的本地存储库设置(我不确定源目录是否有感觉,但我添加它以防万一):
library(tools)
reposRoot <- "C:\\Software\\repository"
r_ver <- "2.15"
contribPaths <- c(source = "src\\contrib", windows = "bin\\windows\\contrib")
write_PACKAGES(paste(reposRoot, contribPaths["windows"], r_ver, sep="\\"),
type="win.binary",
unpacked=FALSE,
latestOnly=FALSE,
verbose=TRUE)
write_PACKAGES(paste(reposRoot, contribPaths["source"], r_ver, sep="\\"),
type="source",
unpacked=FALSE,
latestOnly=FALSE,
verbose=TRUE)
Run Code Online (Sandbox Code Playgroud)
然后我将存储库上传到我的网络服务器:cran.gforge.se但是当我尝试找到我得到的包时:
> available.packages(contriburl="http://cran.gforge.se")
Warning: unable to access index for repository http://cran.gforge.se
Package Version Priority Depends Imports LinkingTo Suggests Enhances OS_type License Archs
File Repository
Run Code Online (Sandbox Code Playgroud)
所以我的结论是它无法找到存储库,但奇怪的部分是我尝试时:
> available.packages(contriburl="http://cran.gforge.se/bin/windows/contrib/2.15")
Package Version Priority Depends Imports
Gmisc "Gmisc" "0.2" NA "grid, testthat, miscTools, rms, Hmisc, survival, …Run Code Online (Sandbox Code Playgroud) 我有一些R代码,我想与我办公室里的其他人分享,也可以在我们的服务器上定期运行.我们都有Windows 7桌面,服务器运行Red Hat Enterprise Linux.
我一直在浏览文档,而且我被困住了.以下所有内容都没有完成所有必要步骤,详细说明正确的文件夹结构,或者告诉我如何构建Linux软件包,或者在Linux上构建Windows软件包.
所以我的代码在git中.
$ mkdir ~/daveStuff
$ cd ~/daveStuff
$ git init
$ git remote add origin git@davez0r.co:/opt/git/daveStuff.git
$ git pull origin master
Run Code Online (Sandbox Code Playgroud)
现在在我的主目录中我有这个文件夹结构:
daveStuff
|-- DESCRIPTION
|-- R
|-- stuff.R
|-- exec
|-- script.R
Run Code Online (Sandbox Code Playgroud)
我的描述文件如下所示:
Package: daveStuff
Type: Package
Title: What the package does (short line)
Version: 1.0
Date: 2014-02-03
Author: Who wrote it
Maintainer: Who to complain to <yourfault@somewhere.net>
Description: More about what it does (maybe more than one line)
License: …Run Code Online (Sandbox Code Playgroud) 我需要在没有Internet访问的Windows 7 PC上支持R环境。
我想下载(最终到DVD)所有5,000个软件包的当前版本,以供该PC上的R用户使用。
是否有FTP脚本或其他好的方法来下载R包的所有zip文件?
我知道R每天都有更新,但是一天的美好就足以让我入门。