[R] loading an updated version of a package during an active R session?

Roger Levy rlevy at ucsd.edu
Thu Apr 10 00:26:12 CEST 2008


I am developing a package and I want to be able to load an updated 
version of the package from within an active R session.  Suppose, for 
example, I have a function f within a package X.  In my active R 
session, I have already loaded X.  Then I change the R source code of f 
within X and rebuild the package as a .tar.gz file on the command line with

   R CMD build X

Within my R session, is there a way to reload X such that the updated 
definition of f will be used?  I have tried:

   > detach("package:X")
   > install.packages("X.tar.gz", repos=NULL, type="source")
   > library(X)

but this seems to use the old version of f.  Any suggestions would be 
much appreciated!

Many thanks in advance!

Roger



More information about the R-help mailing list