marmap
我正在尝试在大学工作站上安装 R 包。我运行的是 Xubuntu LTS 14.04.5,内核版本 4.4.0-45,RStudio 版本 0.99.903 和 R 版本 3.3.1。安装marmap
包时,出现大量信息,最后是
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (igraph)
* installing *source* package ‘gdistance’ ...
** package ‘gdistance’ successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (gdistance)
ERROR: dependency ‘ncdf4’ is not available for package ‘marmap’
* removing ‘/home/francesc/R/x86_64-pc-linux-gnu-library/3.3/marmap’
Warning in install.packages :
installation of package ‘marmap’ had non-zero exit status
在这里,我认为“非零退出状态”意味着它没有正确安装。因此,我ncdf4
首先安装该软件包,结果却遇到了以下问题:
install.packages("ncdf4") Installing package into ‘/home/francesc/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ncdf4_1.15.tar.gz'
Content type 'unknown' length 119570 bytes (116 KB)
==================================================
downloaded 116 KB
* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
configure.ac: starting
checking for nc-config... no
-----------------------------------------------------------------------------------
Error, nc-config not found or not executable. This is a script that comes with the
netcdf library, version 4.1-beta2 or later, and must be present for configuration
to succeed.
If you installed the netcdf library (and nc-config) in a standard location, nc-config
should be found automatically. Otherwise, you can specify the full path and name of
the nc-config script by passing the --with-nc-config=/full/path/nc-config argument
flag to the configure script. For example:
./configure --with-nc-config=/sw/dist/netcdf4/bin/nc-config
Special note for R users:
-------------------------
To pass the configure flag to R, use something like this:
R CMD INSTALL --configure-args="--with-nc-config=/home/joe/bin/nc-config" ncdf4
where you should replace /home/joe/bin etc. with the location where you have
installed the nc-config script that came with the netcdf 4 distribution.
-----------------------------------------------------------------------------------
ERROR: configuration failed for package ‘ncdf4’
* removing ‘/home/francesc/R/x86_64-pc-linux-gnu-library/3.3/ncdf4’
Warning in install.packages :
installation of package ‘ncdf4’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpC5Luhz/downloaded_packages
当我尝试在终端中运行建议的命令时:
R CMD INSTALL --configure-args="--with-nc-config=/home/francesc/bin/nc-config" ncdf4
答复如下:
~$ sudo R CMD INSTALL --configure-args="--with-nc-config=/home/francesc/bin/nc-config" ncdf4 [sudo] 密码: 警告:无效的包‘ncdf4’ 错误:错误:未指定包
现在我有点不知所措,有人能给我指明正确的方向吗?非常感谢!
PS 本月初,我在命令行中找到并应用了一个超级简单的命令来安装 R 包,但我似乎找不到了。实际上是一个五个字的字符串,它可以从终端完美地安装 R 包。有没有一种简单的方法可以从命令行安装 R 包?
弗朗西斯克
答案1
ncdf4
需要安装系统库,因此您有几个选择:
ncdf4
从存储库安装预构建的包:sudo apt-get install r-cran-ncdf4
这将自动引入所需的系统依赖项。
或者,您可以明确安装系统依赖项:
sudo apt-get install netcdf-bin
然后,安装 R 包:
> install.packages('ncdf4')