R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"

Copyright (C) 2013 The R Foundation for Statistical Computing

Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.

You are welcome to redistribute it under certain conditions.

Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.

Type 'contributors()' for more information and

'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or

'help.start()' for an HTML browser interface to help.

Type 'q()' to quit R.

> install.packages('devtools')

Installing package into ‘/home/kingslee/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)

Warning in install.packages :

  dependency ‘xml2’ is not available

also installing the dependency ‘rversions’

--2015-07-29 12:02:27--
https://cran.rstudio.com/src/contrib/rversions_1.0.2.tar.gz

Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.188.51

Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.188.51|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 4654 (4.5K) [application/x-gzip]

Saving to: ‘/tmp/Rtmpcd8fcf/downloaded_packages/rversions_1.0.2.tar.gz’

     0K ....                                                  100%
540M=0s

2015-07-29 12:02:29 (540 MB/s) -

‘/tmp/Rtmpcd8fcf/downloaded_packages/rversions_1.0.2.tar.gz’ saved [4654/4654]

--2015-07-29 12:02:29--  https://cran.rstudio.com/src/contrib/devtools_1.8.0.tar.gz

Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.188.51

Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.188.51|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 141487 (138K) [application/x-gzip]

Saving to: ‘/tmp/Rtmpcd8fcf/downloaded_packages/devtools_1.8.0.tar.gz’

     0K .......... .......... .......... .......... .......... 36%  388K 0s
    50K .......... .......... .......... .......... .......... 72%  487K 0s
   100K .......... .......... .......... ........             100%  440K=0.3s

2015-07-29 12:02:30 (434 KB/s) -

‘/tmp/Rtmpcd8fcf/downloaded_packages/devtools_1.8.0.tar.gz’ saved [141487/141487]

ERROR: dependency ‘xml2’ is not available for package ‘rversions’

* removing ‘/home/kingslee/R/x86_64-pc-linux-gnu-library/3.0/rversions’
Warning in install.packages :

  installation of package ‘rversions’ had non-zero exit status

ERROR: dependency ‘rversions’ is not available for package ‘devtools’

* removing ‘/home/kingslee/R/x86_64-pc-linux-gnu-library/3.0/devtools’
Warning in install.packages :

  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in

    ‘/tmp/Rtmpcd8fcf/downloaded_packages’

最佳答案

您可能会在机器上安装该xml工具。

sudo apt-get -y install libxml2-dev


如果确实消除了您的错误,则应遵循this post以获得有关如何在Ubuntu上正确设置R的更多说明。

07-24 09:25