From h.wickham at gmail.com  Mon Mar 26 19:33:39 2007
From: h.wickham at gmail.com (hadley wickham)
Date: Mon, 26 Mar 2007 12:33:39 -0500
Subject: [Rd] Developer work cycle
In-Reply-To: <4607F803.7060700@decsai.ugr.es>
References: <4607F803.7060700@decsai.ugr.es>
Message-ID: <f8e6ff050703261033i744a6a0eu112c576dabfa61bb@mail.gmail.com>

On 3/26/07, "Jos? Luis Aznarte M." <jlaznarte at decsai.ugr.es> wrote:
>     Hi! I've been browsing through the last months' archive and I can't
> find an answer to my question, so here it is (let's hope it's not too
> obvious):
>     I'm working on extensions of an R library, and I would be very
> surprised if everyone developing R packages is doing the following, as I do:
>
>         1.- Write down a modification of an R file
>         2.- Exit the current R session
>         3.- Install the package as root (sudo R CMD INSTALL...)
>         4.- Launch a new R session
>         5.- Test the change, if it does not work, go back to 1 or debug.
>         6.- Finish.
>
>     Is this the proper (but quite awkward) way to proceed or there is an
> alternative to skip steps 2 to 4? I'm using emacs with ESS under linux.
> Thank you in advance for your time! Best regards,

I have a file in the root directory of all of my packages that looks like this:

library(meifly)
lapply(dir("~/documents/meifly/meifly/R", "\\.[Sr]$", full.name=T), source)

That way I can modify files in my text editor, and then run
source("load.r") to update all my changes.  This isn't completely full
proof as it loads everything into the global workspace so any
namespace problems won't be apparent.

I also have

"\e[A": history-search-backward
"\e[B": history-search-forward

in my .inputrc file.  This lets me type in "s", then press the up key
a couple of times to get back to the last time I used source(...).
Similarly for any other prefix of a previously typed command - this is
a huge time saver.

Finally, in ~/.profile  I have

alias R='R --no-save --no-restore-data --quiet'

which saves me a few keystrokes when quitting R (and a lot of guff
when I open R) and ensures I always start with a clean workspace.

Hadley



[Rd] Developer work cycle
hadley wickham