Freitag, 21. November 2008

Setting up Textmate to use R

After becoming frustrated using the StatET plugin for Eclipse on my Mac (sometimes the R console would start and sometimes not), I decided to use Textmate instead. Textmate allows you to install extra bundles which are plug-ins to add some new functionality to TextMate. There are two bundles relevant for R developers:
- R bundle (here)
- Latex bundle (here)
- Sweave bundle (here)

If you are running Leopard (Mac OS 10.5), the subversion client should be installed (otherwise, do so - you can find more info about this on the TextMate help pages).

To install the two bundles, invoke the following terminal spells:

mkdir -p /Library/Application\ Support/TextMate/Bundles
cd /Library/Application\ Support/TextMate/Bundles
svn co
svn co
svn co

Start up TextMate and now you have support for R and Sweave in TextMate (this assumes that you already have installed a copy of Latex - get the MacTeX-2008 distribution here).

Chances are that if you want to "Sweave, Typeset and View" R will choke because it does not find the necessary Sweave LaTeX style file (sweave.sty) file. If this is the case, just put a copy of sweave.sty into your working directory and everything will work wonderfully (yes, I know that this should be fixable by setting up the right search path somewhere, so if you have run into this problem and fixed it better than me, please send some enlightening commentaries!).


Mark Heckmann hat gesagt…

Hi Karsten,

ONE way to evade to have to put Sweave.sty into the working directory is the following: Copy it into the tex directories.

Let's assume we have installed R and MaxTex from the package installer. Then "telling MacTex where Sweave is" works like:

mkdir -p ~/Library/texmf/tex/latex

cd ~/Library/texmf/tex/latex

ln -s /Library/Frameworks/ R.framework/Resources/share/texmf Sweave

I found it here:

Grüsse, Mark

Unknown hat gesagt…

I found and tried this free unlimited sms to all network website. You can send unlimited texts to all Philippine subscribers.
We can also meet new friends and txtmates through discussion and chat.

Visit this link

Andrew hat gesagt…

Hey there, so I know it's been a couple of years, but believe it or not this is still one of the few resources on Sweave and LaTeX. Just fyi, the code that Mr. Heckmann included does not work as is. You need to actually copy a copy of the Sweave.sty file into the location


Or at least that's what worked for me.