无法使用install.packages安装R-forge软件包 [英] Cannot install R-forge package using install.packages

查看:255
本文介绍了无法使用install.packages安装R-forge软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

询问超过上方, 在 R-sig-finance 邮件列表中,但我认为并没有要求stackoverflow.

This, question, is, asked, over, and, over, and, over, on the R-sig-finance mailing list, but I do not think it has been asked on stackoverflow.

它是这样的:

在哪里可以获得R-forge上托管的XYZ软件包的最新版本?我尝试使用install.packages安装它,但这就是发生的情况:

Where can I obtain the latest version of package XYZ that is hosted on R-forge? I tried to install it with install.packages, but this is what happened:

> install.packages("XYZ",repos="http://r-forge.r-project.org")
Warning message: package ‘XYZ’ is not available (for R version 2.15.0)

在R-forge网站上查找XYZ,我发现该软件包无法构建. 因此,没有下载源的链接.还有其他办法吗 获得源代码?获得源代码后,如何将其转换为 我可以用library("XYZ")加载的软件包?

Looking on the R-forge website for XYZ, I see that the package failed to build. Therefore, there is no link to download the source. Is there any other way to get the source code? Once I get the source code, how can I turn that into a package that I can load with library("XYZ")?

推荐答案

R-Forge可能由于多种原因而无法构建软件包.可能是 该文档尚未更新以反映代码中的最新更改.或者, 可能是某些依赖项在构建时不可用.

R-Forge may fail to build a package for a few different reasons. It could be that the documentation has not been updated to reflect recent changes in the code. Or, it could be that some of the dependencies were not available at build time.

您可以使用svn签出源代码.首先,在 R-Forge网站并转到项目主页-例如 http://r-forge.r-project.org/projects/returnanalytics/ 单击SCM链接以访问如下页面: http://r- forge.r-project.org/scm/?group_id=579

You can checkout the source code using svn. First, search for the project on the R-Forge website and go to the project home page -- for example http://r-forge.r-project.org/projects/returnanalytics/ Click the SCM link to get to a page like this http://r-forge.r-project.org/scm/?group_id=579

此页面将告诉您用于检出项目的命令.在这种情况下,您会得到

This page will tell you the command to use to checkout the project. In this case you get

可以使用以下命令通过匿名访问检出该项目的SVN存储库.

This project's SVN repository can be checked out through anonymous access with the following command(s).

svn结帐svn://svn.r-forge.r-project.org/svnroot/returnanalytics/

svn checkout svn://svn.r-forge.r-project.org/svnroot/returnanalytics/

如果您使用的是Windows,则可能要下载并安装 TortoiseSVN

If you are on Windows, you probably want to download and install TortoiseSVN

一旦安装了TortoiseSVN,则可以在Windows资源管理器窗口中右键单击并选择 "SVN结帐".在资源库的网址:"字段中,输入除 您在R-Forge上找到的命令的"svn checkout"部分.在这种情况下,您会 输入"svn://svn.r-forge.r-project.org/svnroot/returnanalytics/".

Once you have installed TortoiseSVN, you can right click in a Windows Explorer window and select "SVN checkout". In the "URL of repository:" field, enter everything except the "svn checkout " part of the command that you found on R-Forge. In this case, you'd enter "svn://svn.r-forge.r-project.org/svnroot/returnanalytics/".

当您单击确定"时,该项目将被下载到当前目录中.

When you click OK, the project will be downloaded into the current directory.

如果您使用的是类似UNIX的系统(或者如果您安装了命令行客户端工具, 当您安装Windows版TortoiseSVN(不是默认设置)时,可以 在终端(系统终端,而不是R终端)中键入R-forge给您的命令

If you are on a UNIX-alike system (or if you installed the command line client tools when you installed TortoiseSVN for Windows, which is not the default), you can type the command that R-forge gave you in your terminal (System terminal, not the R terminal)

svn checkout svn://svn.r-forge.r-project.org/svnroot/returnanalytics/

这将在当前工作目录下创建一个新目录, 包含软件包中的所有文件.在该目录的顶层 将是一个名为"pkg"的子目录.这个特定的项目(returnanalytics) 包含多个软件包.

That will create a new directory under the current working directory that contains all of the files in the package. In the top level of that directory will be a subdirectory called "pkg". This particular project (returnanalytics) contains more than one package.

ls returnanalytics/pkg
#FactorAnalytics  MPO  PApages  PerformanceAnalytics  PortfolioAnalytics

但是一些R-forge项目只有一个软件包.例如

But some R-forge projects only have a single package. e.g.

svn checkout svn://svn.r-forge.r-project.org/svnroot/random/
#Checked out revision 14.
ls random/pkg
#DESCRIPTION  inst  man  NAMESPACE  R

现在,如果您希望能够在本地复制所有代码, 安装该软件包,您必须先构建它.

Now that you have a local copy all of the code, if you would like to be able to install the package, you have to build it first.

警告:由于R-Forge无法构建软件包,因此很有可能 包裹有问题.因此,如果您仅构建它,您可能会发现 某些事情无法按预期进行.特别是那里 缺少文档或文档不完整.

A WORD OF CAUTION: Since R-Forge failed to build the package, there is a good chance that there are problems with the package. Therefore, if you just build it, you may find that some things do not work as expected. In particular, it is likely that there is missing or incomplete documentation.

如果您使用的是类似UNIX的系统,则可以相对轻松地构建和安装该软件包.对于像returnanalytics这样的多包项目,如果要安装,例如这 PortfolioAnalytics程序包,您可以像这样

If you are on a UNIX-alike system, the package can be built and installed relatively easily. For a multi-package project like returnanalytics, if you want to install, e.g. the PortfolioAnalytics package, you can do it like this

R --vanilla CMD INSTALL --build returnanalytics/pkg/PortfolioAnalytics 

"PortfolioAnalytics"是包含以下软件包的目录的名称: 您要构建/安装.对于单包项目,您可以像这样构建和安装 这个

"PortfolioAnalytics" is the name of the directory that contains the package that you want to build/install. For a single-package project, you can build and install like this

R --vanilla CMD INSTALL --build random/pkg

如果您想在Windows上构建/安装软件包,请参见

If you would like to build/install a package on Windows, see this question and follow the two links that @JoshuaUlrich provided

更多信息,请参见 R安装和管理 R-Forge用户手册 ,以及 SVN手册.

More information can be found in R Installation and Administration, the R-Forge User Manual, and the SVN manual.

这篇关于无法使用install.packages安装R-forge软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆