我正在使用R 3.0.2并尝试安装网格包,如下所示:
install.packages("lattice")
这会导致以下错误:
Error : Invalid DESCRIPTION file
Invalid Priority field. Packages with priorities 'base' or 'recommended' or 'defunct-base' must already be known to R.
我该如何解决?
由于DESCRIPTION似乎只包含元信息,我不明白为什么这会妨碍我安装网格包。
更新
我已安装了网格,但由于某些依赖性,需要更新的版本。使用update.packages()
进行网格返回与上面相同的错误。我想知道新的晶格版本是否有可能与新的R版本兼容?
看到BondedDust引用的描述我开始研究它,看起来新的包在DESCRIPTION文件中有一个Priority字段,但是格式描述文件的旧版本没有。这为什么重要?
me@tang:~/test_lattice$ grep Priority /home/endrebak/local/anaconda/lib64/R/library/lattice/DESCRIPTION
me@tang:~/test_lattice$ grep Priority lattice/DESCRIPTION #New version
Priority: recommended
我尝试使用Priority: recommended
行更新旧的DESCRIPTION文件并重新加载R,但仍然
>rownames(installed.packages(priority="recommended"))
NULL
#rownames(installed.packages(priority="base")) works fine, however.
以下完整错误消息:
trying URL 'http://cran.uib.no/src/contrib/lattice_0.20-29.tar.gz'
Content type 'application/x-gzip' length 347091 bytes (338 Kb)
* installing *source* package ‘lattice’ ...
** package ‘lattice’ successfully unpacked and MD5 sums checked
Error : Invalid DESCRIPTION file
Invalid Priority field.
Packages with priorities 'base' or 'recommended' or 'defunct-base' must
already be known to R.
See the information on DESCRIPTION files in section 'Creating R
packages' of the 'Writing R Extensions' manual.
ERROR: installing package DESCRIPTION failed for package ‘lattice’
* removing ‘/home/me/local/anaconda/lib64/R/library/lattice’
* restoring previous ‘/home/me/local/anaconda/lib64/R/library/lattice’
The downloaded source packages are in
‘/tmp/Rtmptpj1ff/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("lattice") :
installation of package ‘lattice’ had non-zero exit status
答案 0 :(得分:1)
我通过升级到R 3.2修复了这个错误。
答案 1 :(得分:-1)
我通过删除描述文件中的“优先级:推荐”这一行解决了此问题