Results 1 to 8 of 8

Thread: [SOLVED] Link gedit with Sweave in R

  1. #1
    Join Date
    Apr 2007
    Location
    Provo, UT
    Beans
    157
    Distro
    Ubuntu 8.10 Intrepid Ibex

    [SOLVED] Link gedit with Sweave in R

    I just learned how to link Gedit with R so I can run R code from inside Gedit. Now I'm curious - would it be possible to use an "External Command" to launch R and run the Sweave command on the .rnw file currently open? Heck, getting one step better, could I then (in the same command) run latex to make a PDF?

    In case you know the answer but don't use R, R is a statistical programming package. When running R you can issue a command Sweave("name of file") which will parse all R code inside a TeX document and produce a .tex file which can then be parsed into PDF or whatever.
    ASUS M2A-MVP, AMD Athlon 64 X2 4000+, 3 Gb DDR2 800Mhz, GeForce 8600GT XXX Edition, Ubuntu 8.10

  2. #2
    Join Date
    Apr 2007
    Location
    Provo, UT
    Beans
    157
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: [SOLVED] Link gedit with Sweave in R

    Alright, so, I figured it out with the help of a friend and Google. After installing the LaTeX plugin (you can download it here) there is a native option for building the .rnw file called "R Sweave PDF" (don't know how I missed it). But it doesn't work by default.

    Under Edit-Preferences and then the tab Plugins, you can edit the LaTeX plugin. After you click "Configure Plugin" you'll want to click on the tab in the new window called "Build Options"

    Scroll down to the R Sweave PDF and click "Edit"

    The first problem (and this is a problem everybody will have) is that the first command is
    Code:
    R Sweave %e.Rnw
    The correct command is
    Code:
    R CMD Sweave %e.Rnw
    or if you're like me and name your files .rnw
    Code:
    R CMD Sweave %f
    After you make the change, hit your Enter button to save the change (it's really finiky for me.

    Now, your LaTeX PDF Build code is still probably saying "Rubber" Maybe you have this installed, or maybe you installed TeXLive like I did. If you installed TeXLive, you'll want to change the code on the second line to:
    Code:
    pdflatex -interaction=nonstopmode %e.tex
    and then make sure that the Processor is set to Default (it's a drop box just to the right of the command).

    Hope this ends up helping somebody in addition to me!
    ASUS M2A-MVP, AMD Athlon 64 X2 4000+, 3 Gb DDR2 800Mhz, GeForce 8600GT XXX Edition, Ubuntu 8.10

  3. #3
    Join Date
    May 2008
    Beans
    75

    Re: [SOLVED] Link gedit with Sweave in R

    So how did you get gedit to run R code directly? I can't seem to figure that one out.

    Thanks.

    - ccc

  4. #4
    Join Date
    Nov 2006
    Location
    New Zealand
    Beans
    422

    Re: [SOLVED] Link gedit with Sweave in R

    I and many others would like to know how you did that too.

  5. #5
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: [SOLVED] Link gedit with Sweave in R

    BTW, Rubber is not an alternative to TexLive but rather a cool, little python program that automates the compilation of LateX to PDF. It deals with all the re-running of pdflatex and bibtex, etc. So with rubber you only need one command and it outputs the errors and warnings in a much cleaner format.

    It’s in the repos.

  6. #6
    Join Date
    Apr 2008
    Beans
    7

    Re: [SOLVED] Link gedit with Sweave in R

    Quote Originally Posted by samden View Post
    I and many others would like to know how you did that too.
    There is a plugin for gedit called Rgedit, it allows you to run your R script to the console. See http://live.gnome.org/Gedit/Plugins.

    You have to download the file, extract the folder and place it in ~/.gnome2/gedit/plugins folder. Then open gedit and go to Edit Preferences Plugins and enable it.

    HTH,

    Roberto

  7. #7
    Join Date
    Oct 2009
    Beans
    3

    Re: [SOLVED] Link gedit with Sweave in R

    Hi pofigster

    I have wanted the same feature as you, and now I am so happy that you post the resolution. I have followed the steps you described, only I keep the rubber part, coz I have that installed. I load a .rnw file, but dont get the option to

    R sweave -> pdf

    please help!

  8. #8
    Join Date
    Apr 2009
    Beans
    1,173

    Re: [SOLVED] Link gedit with Sweave in R

    Quote Originally Posted by roems View Post
    There is a plugin for gedit called Rgedit, it allows you to run your R script to the console. See http://live.gnome.org/Gedit/Plugins.
    That is the best Linux tip I have seen in a long time. I have struggled with R Commander and tkl interfaces, but having a direct run out of an editing environment is brilliant.

    Man thanks.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •