如何安装"R-essentials"中不可用的R软件包? [英] How to install R packages that are not available in "R-essentials"?
问题描述
我使用现成的Anaconda安装来使用Python.现在我已经读到,有可能也将R世界包含"在此安装中,并在 Jupyter/Ipython笔记本 中使用IR内核.
I use an out-of-the-box Anaconda installation to work with Python. Now I have read that it is possible to also "include" the R world within this installation and to use the IR kernel within the Jupyter/Ipython notebook.
我找到了安装许多著名的R软件包的命令:conda install -c r r-essentials
I found the command to install a number of famous R packages: conda install -c r r-essentials
我的初学者的问题:
如何安装 R-essential 软件包中未包含的R软件包?例如,CRAN上可用的R包."pip"仅适用于PyPI Python软件包,不是吗?
How do I install R packages that are not included in the R-essential package? For example R packages that are available on CRAN. "pip" works only for PyPI Python packages, doesn't it?
推荐答案
现在我已经找到了文档:
这是说明如何生成仅在CRAN存储库中可用的R包的文档: https://www.continuum.io/content/conda-data-science
This is the documentation that explains how to generate R packages that are only available in the CRAN repository: https://www.continuum.io/content/conda-data-science
转到构建conda R程序包"部分.
Go to the section "Building a conda R package".
(提示:只要anaconda.org下的R包可用,请使用此资源.请参见此处:
(Hint: As long as the R package is available under anaconda.org use this resource. See here: https://www.continuum.io/blog/developer/jupyter-and-conda-r)
alistaire 的答案是添加R包的另一种可能性:
alistaire's answer is another possibility to add R packages:
如果您通过常规的 install.packages
(来自CRAN镜像)或 devtools :: install_github
(来自GitHub)从R内部安装软件包,则它们可以正常工作.@alistaire
If you install packages from inside of R via the regular install.packages
(from CRAN mirrors), or devtools::install_github
(from GitHub), they work fine. @alistaire
操作方法:打开您的(独立)R安装,然后运行以下命令:
How to do this: Open your (independent) R installation, then run the following command:
install.packages("png", "/home/user/anaconda3/lib/R/library")
将新软件包添加到Jupyter使用的正确R库中,否则该软件包将安装在中提到的/home/user/R/i686-pc-linux-gnu-library/3.2/png/libs中.libPaths().
to add new package to the correct R library used by Jupyter, otherwise the package will be installed in /home/user/R/i686-pc-linux-gnu-library/3.2/png/libs mentioned in .libPaths() .
这篇关于如何安装"R-essentials"中不可用的R软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!