Home > R > Show me yours and I’ll show you mine

Show me yours and I’ll show you mine

I remember when I started with R, there was little processing power directed toward an IDE. I had enough problems with the syntax, loops and the like and R gui seemed adequate. When I started working on a heavy project, I had to knock it up a notch (bam!). After weeks of trial and error with various IDEs I settled for Eclipse. Year was 2010.
After two years, I feel very comfortable in my IDE of choice but I’ve always felt there’s some things I might be missing. That’s why I’m starting “show me yours and I’ll show you mine” project where I wish to collect workflow setup for working for programming and/or data analysis. The idea is to present your setup and comment on why you think it’s (in)efficient for you. I’ll start!

As mentioned, I use Eclipse with a plugin StatET. Eclipse (and StatET) depend on Java, so you’ll probably have to install either JDK or SDK. This may be a limiting factor for some. Eclipse offers a number of handy keyboard shortcuts (for instance CTRL+r+3 sends line/chunk to R, CTRL+r+s sources the entire file…), manages windows, provides different views and more.

My setup has two code editing windows in the upper left corner, project explorer and task list (kudos to Andrie) on the right. Bottom half holds the R console and R help/tasks. I can easily navigate through files while debugging programs and handy keyboard shortcuts really cut down production time. I like having all windows handy. This is aided by Mylyn Task List plugin that helps you store and switch between individual sets of scripts. More about Mylyn can be found here. I also have a button to run knitr script which produces a pdf report (see previous post). I connect to a SVN server where I store my work. Switching to a SVN look is achieved by clicking the “SVN” icon in the top right corner.

I would encourage anyone interested in sharing their ideas about how to set up their workflow on this blog to send me a screenshot and a short description to my gmail account (romunov) or post about it on their own internet outlet (blog, personal website…) and send a traceback back here.

Paul Lemmens uses Vim and “raw” Rgui.

Ever since I’ve completely written my PhD thesis in gVim, those handy keyboard operated commands have engraved themselves as spinal cord reflexes. I just cannot find any other interface that does the trick for me without having to reach to the mouse or these awkward arrow keys.
So usually I open a regular Rgui and gVim window and use the Win7 keyboard shortcuts Winkey+leftarrow and win+right to make them share one of my widescreen monitors. Being in a corparate environment with restrictions, I have put any time in installing the stuff to make R appear in a Vim buffer. Instead, I use Autohotkey to define two keyboard shortcuts to execute a snippet of R code in the Rgui: one shortcut takes me automatically back to the editor and another one copy-pastes the code and stays on the Rgui window. Help/manual pages are being forwarded to my (chrome) browser.

About these ads
Categories: R Tags: , , , , ,
  1. Baldeagle
    August 9, 2012 at 22:36 | #1

    My workflow is remarkably unefficient. All my data is stored on an oracle DB so I use SQL Loader to move the chunk of interest to a local oracle instance on my workstation. Then I do some initial transforms in oracle and drop it to csv (couldn’t get RODBC to work). Finally I just use the stock windows R gui for coding. Viz is output in SVG, tweaked in InkScape and saved as a visio file for sharing.

  2. paul lemmens
    August 10, 2012 at 11:55 | #2

    Ever since I’ve completely written my PhD thesis in gVim, those handy keyboard operated commands have engraved themselves as spinal cord reflexes. I just cannot find any other interface that does the trick for me without having to reach to the mouse or these awkward arrow keys.

    So usually I open a regular Rgui and gVim window and use the Win7 keyboard shortcuts Winkey+leftarrow and win+right to make them share one of my widescreen monitors. Being in a corparate environment with restrictions, I have put any time in installing the stuff to make R appear in a Vim buffer. Instead, I use Autohotkey to define two keyboard shortcuts to execute a snippet of R code in the Rgui: one shortcut takes me automatically back to the editor and another one copy-pastes the code and stays on the Rgui window. Help/manual pages are being forwarded to my (chrome) browser.

    That’s more than sufficient for my limited needs. Boring screen shot here: https://dl.dropbox.com/u/2049298/vim%20r.png

    • svenski
      August 11, 2012 at 09:55 | #3

      Check out the R-vim, you can get the same functionality but without switching windows. But there’s more:
      l send the current line
      ss send the current selection
      h runs head on the current variable where you curser is.

      • paul lemmens
        August 13, 2012 at 08:29 | #4

        Thanks for that hint. Unfortunately, a typo crept into my text: it should have read: I have NOT put in any time to get R in a Vim buffer. R-vim, your suggestion, requires me to install all kinds of additional stuff that I have no use for in my daily life. Therefore, R-vim is not an option for me.

  3. James M. Ward
    August 11, 2012 at 06:00 | #5

    I have a different set of constraints, driven by working on several data analysis projects in parallel over a longer period of time. I tried Eclipse/StatET, and loved the SVN integration. But ultimately when running a heavy process it would hang/stall the editor until the process finished, and I wouldn’t be able to code anything else meanwhile. Maybe that’s not typical any more. I’m strongly considering transitioning to Rstudio though.
    Also I split my effort between a laptop and desktop (processes running on the desktop or server, me working remotely.) Frequently I’m asked to revisit a past analysis, so I need to have my past work readily available to reload promptly.
    So my setup is this:
    Komodo Edit with SciViews-K as a lightweight editor, only really R syntax highlighting, not running R code.
    Remotely SSH into server/desktop, run “byobu” (atop GNU screen) for multiwindow terminal, that I can keep sessions running when I disconnect. I have multiple R sessions open in different windows at all times.
    I use iTerm for 256-color mode, and xterm256 for R color enhancements. I tweaked R options so colored output can help me remember what I’m doing. The “colorout” package seems easier/nicer, but I’m already using xterm256. Color is good.
    I wrote R functions “loadSession()” and “saveSession()” which save Rhistory and RData in a structured way with datestamp in the filenames so I can save periodic snapshots for a project, and can resume any project by supplying projectName. I also wrote “grepSession()” to find stuff!
    Once a task reaches a milestone, I export results files/plots, saveSession, then I can close that R session to free memory if needed.
    I put the projectName into a color R prompt to reinforce which terminal window is for which analysis.
    I use unison for syncing my R analysis scripts between desktop/laptop. I like the idea of using svn or git, but haven’t gotten a private repo into my workflow yet. Either would be fine — but I couldn’t live without some automated way to sync-up my work.
    I use X-windows forwarding for remote graphical display. Painful for intricate detailed plots, which I save to pdf, but otherwise fairly good. There’s got to be a better way, like having R draw locally, then send me the raster. (I tried wrappering png() and readPNG() but I didn’t get it pretty enough for daily use.)
    I don’t use .RData files, I don’t want them scattered throughout 100 directories — I want them all in one place and with names a human could try to understand. :-)

    • paul lemmens
      August 13, 2012 at 08:30 | #6

      I’m actually quite curious for your session-saving scripts and functions! Would you be willing to share?

  1. August 10, 2012 at 17:14 | #1
  2. August 13, 2012 at 01:32 | #2
  3. August 28, 2012 at 14:55 | #3

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: