3

I am on an Ubuntu 18.04 machine with R version 3.5.1, installed following this link. I am trying to install the CRAN package rJava, which I do the following way (as seen here):

sudo apt-get install r-cran-rjava

However, I get this:

The following packages have unmet dependencies:
 r-cran-rjava : Depends: r-api-3.4
E: Unable to correct problems, you have held broken packages.

But when I try:

sudo apt-get install r-api-3.4

I get:

E: Package 'r-api-3.4' has no installation candidate

How to overcome this problem with r-api-3.4? Basically, I need to install rJava to be able to install and use XLConnect... In Ubuntu 16.04, I had no problems whatsoever...

EDIT:

Apparently, r-api-3.4 should be provided by r-base-core. I do have r-base-core installed in its newest version, why do I still see errors then?

0

I guess the issue is that, when you were trying to install r-cran-rjava, it required you to have R 3.4 on your system (i.e. the version of the official Ubuntu repositories) rather than R 3.5.

It looks like this can be an issue for other packages, like rkward for example (it also asks for r-api-3.4 and can't resolve the dependency).

To fix that, you might have to add an extra PPA that provides newer version of extra R packages for the 3.5 branch, like Michael Rutter's cran2deb4ubuntu_3.5, which seems to be the reference. (It currently contains r-cran-rjava in its version 0.9-10-3cran1ppa0bionic0)

This might do the trick:

sudo add-apt-repository ppa:marutter/c2d4u3.5
sudo apt update
sudo apt install r-cran-rjava

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.