[ESS] Developing R packages under ESS
Ross.Boylan at ucsf.edu
Thu Mar 8 02:28:30 CET 2018
Can anyone suggest to me a good way to develop R packages with ESS? "good" here means that I can debug the code and make changes to the code without rebuilding the whole package.
So far I've tried a bunch of different approaches, but none has quite worked.
1. When I had an old (or even new) version of the package in the standard load paths I tended to get "namespace is locked" errors when I modified the code and attempted to read it in. So I deleted the installation in the standard path.
2. Wrote a script that sourced all the .R files. But when I change them and reload in ESS I get the error "unable to load <mylibrary>", even if I do C-c C-t C-s to turn off the namespace. I suspected the problem might have been from evaluating vignette code in an .rnw file, but even if I copied and pasted it into the the main *R* buffer I still get the problem:
Loading required package: LazarSim
Error in .requirePackage(package) (from SimParameters.R#35) :
unable to find required package ‘LazarSim’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘LazarSim’
BTW, that error happened after I attempted to execute some code from the package, not when I issued any load/library/require type command.
R is running in the directory above the package directory.
Grep confirms my recollection that I don't have code that does require().
Maybe R overrides the basic code for sourcing files? My test file uses source() to load the source files, which are in the package directory.
Thanks for any help.
More information about the ESS-help