
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 Ubuntu, follow the steps described below, or use the (outdated) installation script that I developed for this purpose.
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 Ubuntu 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 (replacing codename with your release code name; for example, mine release is called precise, from Precise Pangolin):
deb http://cran.r-project.org/bin/linux/ubuntu codename/
Add the secure key for the Ubuntu archives on CRAN (run in terminal):
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
Install R (run from terminal):
sudo apt-get update
sudo apt-get install r-base-dev
To avoid some later errors:
sudo apt-get install libx11-dev libglu1-mesa-dev libxml2-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")
})
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/")
})
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
For this step follow instructions from the post How to install Java / OpenJDK in Ubuntu. Do not forget after that to 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.
If it is opened, close the 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.
Depending of your distribution, now you must have a functional menu entry for JGR in Applications menu (in Science or Education submenu).
UPDATE (March 13, 2018)
Edit (or create a new one) the /usr/local/lib/R/site-library/JGR/scripts/run file and replace it content with the code outputed by the JGR() command.
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.
See the (more recently updated) Romanian version / vezi versiunea în română: Instalarea limbajului R în Ubuntu
Thanks man!
ReplyDeleteNow i have installed the Deducer let's play statistics ;)
Hi! I created a script to do that automatically in ubuntu: http://victorpillac.wordpress.com/?p=653
ReplyDeleteCheers
I had the following error:
ReplyDeleteERROR: dependencies ‘rJava’, ‘iplots’ are not available for package ‘JGR’
after running:
install.packages(c('JGR', 'Deducer', 'DeducerExtras'))
I solved it running everything as root instead of sudo.
I cannot help you with the error that you encountered, because I do not understand why it occurs, but I am glad that you solved it :).
DeleteAll the best!
P.S. Maybe this link will be helpful: http://stackoverflow.com/questions/7129303/cant-install-rjava-0-9-on-ubuntu-10-04
Thanks a lot.
ReplyDeleteAn addition. In Kubuntu (or any KDE distro) in item 4 (Create a .desktop file) instead of nano you should run Kate
sudo kate /usr/share/applications/jgr.desktop
Thank you!
ReplyDeleteI replaced the "nano" with a generic "editor".
I am facing this Error in Ubuntu:
ReplyDelete> library(JGR)
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots
Please type JGR() to download/launch console. Launchers can also be obtained at http://www.rforge.net/JGR/files/.
> JGR()
Error in .generate.run.script() :
JRI is required but missing! Make sure R was configured with --enable-R-shlib and rJava was compiled with JRI support.
>
What should I do?
Do you followed the step 2? You must install the Java Development Kit and enable Java support in R. For this step follow instructions from the post "How to install Java / OpenJDK in Ubuntu". Do not forget after that to enable Java support in R (run in terminal): sudo R CMD javareconf
DeleteThank you sir for your kind response. Yes, I followed the step 2. Then I also ran "sudo R CMD javareconf" in Terminal. It shows that
Delete$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.6.0_24
Java home path : /usr/lib/jvm/java-6-openjdk/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags : -I$(JAVA_HOME)/../include
Updating Java configuration in /usr/local/lib64/R
Done.
But still I am facing this Error in Ubuntu:
> library(JGR)
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots
Please type JGR() to download/launch console. Launchers can also be obtained at http://www.rforge.net/JGR/files/.
> JGR()
Error in .generate.run.script() :
JRI is required but missing! Make sure R was configured with --enable-R-shlib and rJava was compiled with JRI support.
>
I am using Ubuntu 11.04 OS with 64Bits Platform.
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
What should I do now?
Sorry, I can only suggest you to repeat (carefully) the step from the post How to install Java / OpenJDK in Ubuntu. If this will not help you can go to the stats-rosuda-devel mailing list and ask about this error.
DeleteThank you so much for this amazing tutorial!
ReplyDeleteWorked like a charm, except that I had to replace the "Exec=" path line by the one that the first launch of JGR gave me, because the one you gave did not direct to any existing script (I am using Ubuntu 12.10, 32 bits).
If anyone has this problem (the JGR launcher not doing anything), make sure you copy the path that the command JGR() gives you in R.
One last thing: in your last paragraph, it should be "science", not "sciense".
Keep up the great work, cheers! :)
Thank you for the comment, chtfn! I corrected the mistake that you observed (sciense). Could you give me also the correct path of JGR launcher in Ubuntu 12.10?
DeleteI have completely read your post and the content is crisp and clear. Thank you for posting such an informative article, I have decided to follow your blog so that I can myself updated...R Programming Training in Bangalore
ReplyDeleteIt is really a great work and the way in which you are sharing the knowledge is excellent.Thanks for your informative article
ReplyDeleteR Programming Online Training|
Tableau Online Training|
SAS Online Training |
Brilliant post, Thanks for such detailed explanation. Looking forward for more of your work.
ReplyDeleteRegards,
Linux Online Training India
Best Institutes for Linux
Linux Administration Training in Hyderabad
Linux Certification Training
Linux Training in Ameerpet, Hyderabad
Red Hat Linux Training in Hyderabad
Linux Certification Training in Hyderabad
Best Linux online Training Institutes in Hyderabad
Learn Linux
Learn Linux Online
It was useful, but it always gives this output, when trying to run JGR():
ReplyDelete#!/bin/sh
export R_HOME="/usr/lib/R"
export R_ARCH=""
export R_LIBS="/home/karamfil/R/x86_64-pc-linux-gnu-library/3.2:/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library"
export R_LIBS_USER="~/R/x86_64-pc-linux-gnu-library/3.2"
export JAVA_LD_PATH="/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server:@JAVA_LD@"
'/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java' -cp '/home/karamfil/R/x86_64-pc-linux-gnu-library/3.2/rJava/java/boot' -Drjava.class.path='/home/karamfil/R/x86_64-pc-linux-gnu-library/3.2/rJava/jri/JRI.jar:/home/karamfil/R/x86_64-pc-linux-gnu-library/3.2/JGR/java/JGR.jar:/usr/lib/R/etc/classes:/usr/lib/R/etc/classes/classes.jar' -Drjava.path='/home/karamfil/R/x86_64-pc-linux-gnu-library/3.2/rJava' -Dmain.class=org.rosuda.JGR.JGR -Djgr.load.pkgs=yes -Dr.arch= RJavaClassLoader
What I am missing? Btw, I'm on linux mint 18,3
Sorry, these instructions are a little outdated.
DeletePlease follow fully the 4th step (Add a menu entry for JGR).
Then edit (or create a new one) the /usr/local/lib/R/site-library/JGR/scripts/run file and replace it content with the code outputed by the JGR() command.
Now you must have a functional menu entry for JGR in Applications menu (in Science or Education submenu).
The JGR() command always will give that output. You must launch the JGR from the menu entry (see my previous comment how to make it).
Delete