[Rd] Developer work cycle
hadley wickham
h.wickham at gmail.com
Mon Mar 26 19:33:39 CEST 2007
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
More information about the R-devel
mailing list