Saturday, June 29, 2013

How to install R, JGR and Deducer in SolydX Linux

A step-by-step guide about how to install the free statistical software GNU R, JGR and Deducer in SolydX Linux (32-bit, version 201306), an Debian (testing?) derivative distribution.

The combination of GNU R, JGR and Deducer is a powerful free alternative to all proprietary / commercially distributed statistical programs like SPSS. Together, they provide a wide variety of statistical and graphical techniques, combined with intuitive graphical menus and dialogues that guide the user efficiently through the data manipulation and analysis process.

To install R, JGR and Deducer in SolydX Linux (possibly in Debian testing and stable versions too), follow the steps described below.

1. Install the most recent R version

To obtain the latest R packages, add in your /etc/apt/sources.list file a repository URL for the Debian Wheezy (stable version of the Debian) archives on CRAN (choose a CRAN Mirror that is geographically close to you). Run in terminal:
sudo editor /etc/apt/sources.list

and add to the end of the file:
deb http://cran.r-project.org/bin/linux/debian wheezy-cran3/

Add the secure key for the Debian archives on CRAN (run in terminal):
apt-key adv --keyserver subkeys.pgp.net --recv-key 381BA480

Install R (run from terminal):
sudo apt-get update
sudo apt-get install r-base-dev


If your network is behind a proxy/firewall, you can't directly install and update R packages. To solve the problem, you need to add to (one of) /etc/R/Rprofile.site or ~/.Rprofile files the following lines (substituting your own username, password, proxy server and port settings):
local({
Sys.setenv(http_proxy="http://username:password@tcdproxy.tcd.ie:8080")
})

Note that the username:password@ part is needed only if the proxy requires authentication.

For me the added lines was:
local({
Sys.setenv(http_proxy="http://192.168.1.254:3128/")
})

Putting http_proxy=http://192.168.1.254:3128/ in ~/.Renviron will work too.

2. (Install Java Development Kit and) enable Java support in R

In SolydX Java Development Kit is preinstalled, but you can read instructions from the post How to install Java / OpenJDK in Ubuntu. After that enable Java support in R (run in terminal):
sudo R CMD javareconf

3. Install JGR, Deducer, DeducerExtras and DeducerRichOutput packages (for other extension packages for Deducer look in the online manual)

Run in terminal:
sudo R --no-save

Run in R environment:
update.packages(ask=FALSE, repos = 'http://cran.r-project.org')
install.packages(c('JGR', 'Deducer', 'DeducerExtras'), repos = 'http://cran.r-project.org')
install.packages('DeducerRichOutput', repos = 'http://R-Forge.R-Project.org')
install.packages('XLConnect', repos = 'http://cran.r-project.org') ## for importing Excel files

4. Add a menu entry for JGR

Run in R environment (started in previous step):
library(JGR)
JGR()
q()

This will create a launcher for JGR.
Close (if) opened JGR window.

Download an icon image for JGR (run in terminal):
sudo wget http://goo.gl/U5hk9 -O /usr/share/icons/jgr-48x48.jpg

Create a .desktop file for the JGR menu entry. For this run in terminal:
sudo editor /usr/share/applications/jgr.desktop

and copy/paste the bellow content:
[Desktop Entry]
Type=Application
Terminal=false
Name=JGR - Java Gui for R
Exec=/usr/local/lib/R/site-library/JGR/scripts/run
Icon=/usr/share/icons/jgr-48x48.jpg
Comment=Java Gui for R
Categories=Science;Education;

Save created file with Ctrl+X.

5. Set JGR to auto-load Deducer, DeducerExtras and DeducerRichOutput packages

Start JGR from your account (Applications > Science > JGR - Java GUI for R), open Packages & Data > Package Manager menu, select load and default next to Deducer, DeducerExtras and DeducerRichOutput, click on Close button.


0 comments:

Post a Comment