Back of the Envelope

Observations on the Theory and Empirics of Mathematical Finance

R through Excel

leave a comment »

Richard Hieberger and Erich Neuwirth have developed a wonderful little tool call RExcel, which brings the power of R to the ease of Excel. Seems perfect for building prototypes and for in-class illustrations.

Installing the RExcel Addin

The developers claim on their website that RExcel works with Excel 2003, 2007 and 2010

Installing the RExcel add-in is easy. If you don’t have R already installed on your machine, just download and run the “RAndFriends” executable from the statconn website and you are ready to go (it is claimed it installs both R and RExcel while taking care of all the dependencies – I haven’t tried it though).

If you already have R, but rather not tinker with its installation, there is quite a useful wiki to guide one through the steps. I recently installed it on my PC running Excel 2010 Professional and I had no trouble getting it to work. Here are the commands I used. Just run them in order in your R console and you should be up and running:

install.packages("rcom")
library(rcom)
installstatconnDCOM()
comRegisterServer()
comRegisterRegistry()

install.packages("Rcmdr", dependencies = TRUE)
install.packages("RExcelInstaller")
install.packages("HH")
install.packages("RthroughExcelWorkbooksInstaller")
install.packages("RcmdrPlugin.HH")

(I know one can concatenate the above set of commands and use install.packages just once  – it’s just a lot easier this way to ‘see’ what’s going on.)

At this point you should see the R command prompt. Don’t forget to ‘activate’ the installed packages:

library(RExcelInstaller)
installRExcel()
library(RthroughExcelWorkbooksInstaller)
installRthroughExcel()

Now you should have a short-cut on your desktop called RExcel20** with RCommander.

Update: I hastily tried installing statconnDCOM in the latest version of R (2.13.1) and got an error saying statconnDCOM is not available for that version. For new users I would suggest directly installing from the RAndFriends executable.

Advertisements

Written by Vineet

July 15, 2011 at 2:42 pm

Posted in Programming: R

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: