[R-sig-ins] Hacking on the ChainLadder package?
Ben
misc7 at emerose.org
Wed Oct 21 08:56:26 CEST 2009
Thank you very much Romain, these commands work. I thought R (being
an interpreted language, and no part of this package needs
compilation) might have a short-cut to reload a module without
installing, but it really doesn't matter because the build/install
process runs in a few seconds on my computer anyway.
I can also source individual files as you mentioned. Although if I
understand correctly, I need to be careful with that because the
sourced files will affect the bindings in a different namespace than
the original package. Hmm, to continue with this thought, I guess I
could just write a file that sources all the files in the package;
that way I think I could just source the file I changed and the other
files, because they were installed in the default namespace, would
read the changed file.
Thanks again,
--
Ben Escoto
----------------- Original message -----------------
From: Romain Francois <romain.francois at dbmail.com>
To: Ben <misc7 at emerose.org>
Date: Wed, 21 Oct 2009 08:14:52 +0200
On 10/21/2009 05:40 AM, Ben wrote:
>
> Hi all,
>
> I'm new to R but would like to work on (and hopefully contribute
> usefully to) Markus Gesmann's excellent ChainLadder package. However,
> I don't have a development loop in place, so I'd appreciate some
> guidance on how best to work on this. I have the actual package
> installed in
>
> ~/R/x86_64-pc-linux-gnu-library/2.8/ChainLadder
>
> and I have the code checked out from subversion in:
>
> ~/prog/chainladder-read-only
Hi,
what you checked out is the source of the package, this is really
different from the compiled package you'll find in
/R/x86_64-pc-linux-gnu-library/2.8/ChainLadder which is the kind of
structure "library" expects.
The best way is to recompile the package after your change, i.e.
cd prog
R CMD build chainladder-read-only
R CMD INSTALL ChainLadder*.tar.gz
--library=~/R/x86_64-pc-linux-gnu-library/2.8
But you can also just source the file you modified, something like :
R> chainladder.dir <- "~/prog/chainladder-read-only/R"
R> source( file.path( chainladder.dir, "Triangles.R" ) )
Romain
> I'd like some way of editing the files,
> e.g. ~/prog/chainladder-read-only/R/Triangles.R and testing it without
> having to make a whole new package and install it. However, I can't
> seem to load the package from my subversion directory:
>
> > library(ChainLadder, lib="~/prog")
> Error in library(ChainLadder, lib = "~/prog/chainladder-read-only") :
> there is no package called 'ChainLadder'
>
> if I make the symbolic link "ChainLadder" to "chainladder-read-only" I
> get:
>
> > library(ChainLadder, lib="~/prog")
> Error in library(ChainLadder, lib = "~/prog") :
> 'ChainLadder' is not a valid package -- installed< 2.0.0?
>
> which I don't know what it means and google isn't super-helpful. I'm
> also not even sure I'm on the right track.
>
> So anyway, I'd really appreciate it if Markus or another ChainLadder
> or R guru has some tips on how best to use subversion and R. If it
> matters, I'm using emacs/ESS as my editor.
>
> Thank you very much,
>
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos
More information about the R-SIG-insurance
mailing list