Friday, April 20, 2012

R is not just for nerds....it has drop-down menus!

JGR Logo

This post introduces how to use the Java Gui for R (JGR, pronounced Jaguar) along with the Deducer package (manual here) to get a fairly full featured graphical user interface for R.

Installation

Note: Be sure you are logged into an account with administrative privileges, or some stuff won't won't install correctly but will give only cryptic error messages.

  • Make sure you have the most recent version of R (currently 2.15.0) installed. 
  • Install JGR. On Windows, download and run the jgr-1_62.exe file or the jgr-1_62-x64.exe file for 64-bit systems. On Mac OSX, download and run JGR-1.6-SL.dmg.  If you are a Linux/Unix user you can figure this out yourself.
  • Open JGR and make sure you don't get any error messages. If you do I can only suggest the google. Make sure you are an administrator!
  • Now, you can install the Deducer package from within JGR using the package manager.  Find the menu item Packages & Data > Package Installer.  If you are prompted to pick a "CRAN Mirror" select one that is geographically close to you. When a long list of packages appears,  choose "Deducer", and click Install. A lot of text will whiz by as R installs this package from the interwebs (a series of tubes).
  • Once it quits downloading, you need to load the package into active memory. Close the package installer, and from the same Packages & Data menu, choose the Package Manager. You will see a list of available packages.  Check the box next to "Loaded" to load the Deducer package.

The Data Viewer should pop-up with options for you. You are ready to graphically use this interface to R!



Notice that in addition to opening this new window, loading the Deducer package changed the available menu items for JGR.  Now you have things like "Analysis" and "Plots" as options.

Loading Data
Click on "Open Data" to import your data.  JGR/Deducer can open many types of files.  For best results, I would try using a comma or tab delimited text file. Also, double check that each column of data only has one type of data (e.g. a number versus text).  Once you get your data loaded, the pop-up window turns into something like a spreadsheet that shows you your data.  

Plotting

On the menu, click "Plots > Plots Builder".  This feature alone will be worth the price of admission for a lot of people.  If I continue to find this useful, there will be a future post on how this works.  For now....experiment!

Analysis

So now you are ready for some analysis. Ummm...just look at all those new menu items and do whatever analysis you want. The interface is pretty similar to what I have seen of pre-packaged stats programs (like SPSS), but I am not at all fluent in the Menu driven options in either JGR/Deducer or any of those other programs. For much of what you will want to do though, you will do linear models.

Linear Models - The Workhorse of R

What do multiple regression, ANOVA, ANCOVA, MANOVA and Plain-Old Least Squares Regression have in common? They are all linear models.  This simplifies your life because in R, you only have to use this one tool to do a lot of different analyses.  Simply find the menu item "Analysis > Linear Model".  This will launch the below window.




 Choose your outcome variable, as well as any numeric or categorical (factor) variables.  R automatically knows which type of analysis to do based on the input variables.  Assuming your outcome is always continous: put in a single Factor, it will do an ANOVA. Put in two numeric variables, it does multiple regression. Etc.


2 comments:

  1. I work with pretty big data sets and so every time I've tried to use Deducer it just slows to a crawl for me and becomes unusable. It's a pity too because I like it!

    ReplyDelete
  2. Inkhorn: how big are we talking here? The datasets I have used have been small, several hundred rows or so. How big before Deducer slows down?

    ReplyDelete