[ESS] ESS R code evaluation in package

Cyrus Harmon cyru@ @end|ng |rom bobobe@ch@com
Wed Nov 7 01:53:51 CET 2018

I’m having a number of related problems that may stem from fundamental misconceptions about how R code is eval’ed/load’ed/compile’d/etc… but it’s driving me crazy, so here goes. Also, bear in mind that I’m coming from the common lisp world and am a big fan of its package system and Emacs/SLIME for interacting editing/evaluation/etc…

I have a number of R libraries that I have developed and a number of other libraries that use these libraries. It appears that when I edit an R file with ESS that ESS is smart enough to figure out the appropriate namespace and displays it in a line on the bottom status bar like [pkg:mypkg] (please forgive me if I mix up the usage of R's namespaces and packages — it isn’t quite clear to me which term I should use when). This is promising but if I C-c C-r a chunk of code in that file (e.g. a function definition, or should I say an assignment of a function to a new variable) I would expect that the function would now be visible in my packages namespace (e.g. via ls(“package:foo”) but my new function doesn’t appear. I can eval ‘moose()’ from ESS and it is correctly called, so the function is somewhere, but it’s not in my package.

So, for a bunch of related questions?

1. How might I compile 'moose <- function () { “bar” }’ from Emacs/ESS and have moose show up in my package?

2. If it isn’t going into my package now, where is it going?

3. If I can’t do this is there some easy way to build an reinstall an existing R library without having to call me R process and restart every time I want to make a simple change to a library function (this is where I find myself now).

4. Am I missing something obvious here? Is there a better way to do all of this?



More information about the ESS-help mailing list