Install R on Kubuntu

Installing R on Kubuntu, or Ubuntu, with an editor is quite easy. The following steps will possibly work on the most common Linux distributions. Check the official information for more information.

To get R, start by updating the repositories and the get r-base:

$ sudo apt-get update
$ sudo apt-get install r-base

When one needs to develop a R package, the development stuff should also be installed:

$ sudo apt-get install r-base-dev r-recommended

As for an editor, one can use JGR. In order to use it, just follow the official installation under Linux.
JGR is Java based, so when there’s no Java installed, get it using:

$ sudo apt-get install sun-java6-jdk

To install JGR, it’s necessary to enable Java support in R:

$ sudo R CMD javareconf

And then install the JGR library:

$ sudo R
> install.packages('JGR')

After installed, run:

> library(JGR)
> JGR()

JGR has a small problem though, it has been installed as root and it seems unusable with any other user. One can set the correct user permissions for that.

Automating the startup of R with JGR is simple when using a shell script. Name it runr.sh and include:

R -f /home/myUser/bin/jgr.r

While the jgr.r file contains the JGR start commands

library(JGR)
JGR()

Now, running ./runr.sh starts R and JGR all in one.

There are alternatives to JGR. Check Tinn-R and R Commander.