Installing R and JGR on Ubuntu Lucid Lynx

The other day I wanted to install R on Ubuntu. Googling led me to this site, but I found some of them are not up-to-date. In addition, I don’t use Sun-Java but open-JDK. So I needed to change things a little bit.

Below is what I did. Note that I already installed openJDK.

  1. Add an R repository to /etc/apt/sources.list
  2. First, you need to decide a CRAN mirror close to where you live. The list can be found here. Since I live in Tsukuba Japan, I added the following line to /etc/apt/sources.list

    deb http://cran.md.tsukuba.ac.jp/bin/linux/ubuntu lucid/

    Below is the format.

    deb http://my.favorite.cran.mirror/bin/linux/ubuntu lucid/

  3. Obtain the public key of Ubuntu repository
  4. The Ubuntu archives on CRAN are signed with the key of “Michael Rutter
    ” with key ID E084DAB9. You can fetch this key then feed it to apt-key with the following lines.

    $ gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
    $ gpg -a --export E084DAB9 | sudo apt-key add -

  5. Update the respository
  6. $ sudo apt-get update

  7. Install r-base
  8. sudo apt-get install r-base r-base-dev

  9. Upgrade the repository
  10. By upgrading the repository, r-cran-* will be installed.

    $ sudo apt-get upgrade

    The following should be displayed.

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following packages will be upgraded:
    r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools
    r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix
    r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial
    r-cran-survival r-doc-html
    17 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 12.2MB of archives.
    After this operation, 827kB disk space will be freed.
    Do you want to continue [Y/n]?

  11. Set java configuration
  12. $ sudo R CMD javareconf

  13. Start R environment
  14. $ sudo R

  15. Install JGR inside R environment
  16. install.packages('JGR')

    A GUI will popup asking you to select a mirror to download from. Select the same mirror as before, though it doesn’t matter.

    After installation is completed. Add the library and install the ggplot2 library.

    library(JGR)
    install.packages('ggplot2', dep = TRUE)

    This will take some time.

    After that, you can start JGR by typing

    JGR()

    This will bring up JGR.

    But this is not the end. Please look at the shell carefully, which says,

    Starting JGR run script. This can be done from the shell as well, just run
    /usr/local/lib/R/site-library/JGR/scripts/run

    That means that you don’t have to run R first before running JGR.

    Now I will make a launcher of JGR.

    Right-click of GNOME menu –> “Edit Menu”

    That will pop up Main Menu Dialogue.

    In this case, I want to put the JGR launcher under Science, so click “New Item”

    Then you will see JRG in the menu. Note that I got the made the icon of JGR from the JGR site. I also customized the user interface. The screenshot is the from Lin4Neuro.