[R] Load packages from source

Duncan Murdoch murdoch.duncan at gmail.com
Fri Feb 17 15:54:50 CET 2012


On 17/02/2012 7:01 AM, David Cassany wrote:
> Hi all,
>
> I'm developing an R package and I'd like to load it easly while developing,
> debugging and testing. I would like to load it without having to install
> it. Installing it causes me some problems for debugging it, as the code
> file it is executing it not the one I'm editing.

You can tell R to keep debugging information when it installs a package 
by setting the environment variable

R_KEEP_PKG_SOURCE=yes

or by a command line option to R CMD INSTALL (see the help via --help).  
It still won't be "the same code file" because it never is: but it will 
have references to it, and include formatting and comments.

> I've seen the function sourceDirectory from R.utils package which works
> quite fine for me, but would be just perfect to be able to load the package
> as it would be installed (handling dependences, namespaces and all this
> stuff).

As far as I know there's nothing intermediate between sourceDirectory 
and installing a package, other than setting options when installing 
that can skip parts of the operation.

Duncan Murdoch



More information about the R-help mailing list