5

I'm new to R and RStudio but trying to learn and put together a ShinyApps app. I cannot get past Step 1 of the Shinyapps process, which is to install the devtools package in RStudio. I believe the underlying cause is that the "xml2" package dependency is not installed, but I can't seem to resolve that and I don't understand what to do.

I'm on Linux Mint Cinnamon 17.1 on a Dell laptop. I installed RStudio from the Software Manager. In trying to resolve the errors during devtools installation, I've tried installing R and RStudio from slightly newer package downloads using apt-get, I've tried installing xml2 and rversions from RStudio (not available), I've tried using single quotes and double quotes, I've tried adding dependency=true to all RStudio installation attempts, I've restarted both RStudio and the machine numerous times... I'm out of ideas... help?

Following is the output from the devtools installation command inside RStudio, plus the output of "version" in case it helps.

install.packages("devtools")
Installing package into ‘/home/[MyHomeDir]>/R/i686-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘xml2’ is not available
also installing the dependency ‘rversions’

trying URL 'http://cran.rstudio.com/src/contrib/rversions_1.0.1.tar.gz'
Content type 'application/x-gzip' length 4624 bytes
opened URL
==================================================
downloaded 4624 bytes

trying URL 'http://cran.rstudio.com/src/contrib/devtools_1.8.0.tar.gz'
Content type 'application/x-gzip' length 141487 bytes (138 Kb)
opened URL
==================================================
downloaded 138 Kb

ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/home/[MyHomeDir]/R/i686-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/[MyHomeDir]/R/i686-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/RtmpNJIGkV/downloaded_packages’

version
               _                           
platform       i686-pc-linux-gnu           
arch           i686                        
os             linux-gnu                   
system         i686, linux-gnu             
status                                     
major          3                           
minor          0.2                         
year           2013                        
month          09                          
day            25                          
svn rev        63987                       
language       R                           
version.string R version 3.0.2 (2013-09-25)
nickname       [nickname redacted]            
Kurt Wurthrop
  • 85
  • 1
  • 7
  • 1
    See here: http://stackoverflow.com/questions/30794035/install-packagesdevtools-on-r-3-0-2-fails-in-ubuntu-14-04 (it was asked 1 hour ago). –  Jun 12 '15 at 02:46
  • That answer sounds promising (installing R 3.2.0 from updated repositories) but how do we know which Ubuntu version to use (vivid, utopic, trusty, precise)? – Kurt Wurthrop Jun 12 '15 at 03:38
  • http://stackoverflow.com/questions/28413507/how-to-install-r-3-1-2-on-linux-mint-17-1 –  Jun 12 '15 at 03:42
  • 2
    Pascal, it worked! Thank you. Per your first comment above, I installed R 3.2.0 (instead of 3.0.2) from a CRAN repository, and per your second comment, Linux Mint Cinammon 17.1 is built on Ubuntu "trusty". Following install of R 3.2.0, I still had to do the following before installing devtools would work: "sudo apt-get install libxml2-dev" from command prompt, then install.packages("xml2", dependencies=true) and install.packages("rversions", dependencies=true) from the prompt in RStudio. Thanks for the help! – Kurt Wurthrop Jun 13 '15 at 01:28

2 Answers2

8

I had an old R version (3.0.2) running on Ubuntu 14.04. And this is how i had to update R:

  • open the sources list sudo vi /etc/apt/sources.list
  • Add a cran mirror (i.e. deb http://cran.rstudio.com/bin/linux/ubuntu trusty/)
  • Add an APT-key sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 (see cran)
  • Now update R sudo apt-get install r-base

Now i was able to install devtools. In my case ALL, installed packaged where updated, so this could take some time.

Willem Bressers
  • 201
  • 2
  • 5
0

Update to the newest version of R then follow the instructions provided in the link and you should be able to get it installed.

https://github.com/hadley/devtools

JakeC
  • 292
  • 3
  • 11