Unable to install R package in Ubuntu 11.04

The install.packages method

You need to install the ubuntu package libxml2-dev So in a shell prompt type:

sudo apt-get update
sudo apt-get install libxml2-dev

You will need special sudo powers for this.

Ubuntu package method

As Richie and Dirk mentioned, you can also use:

sudo apt-get install r-cran-xml

If you go down this path, I would recommend that you check out the R ubuntu sources page which will ensure you have a current version of R and the associated R packages. This could be important if you are using the LTS version of ubuntu.


The answer by Colin is correct in a narrow sense, but at the same time wrong as you can just say

 sudo apt-get install r-cran-xml

as XML is one of the CRAN packages available in Ubuntu. Do apt-cache search r-cran-* do see the others.