How do you use multiple versions of the same R package?

Posted by Richie Cotton on Stack Overflow See other posts from Stack Overflow or by Richie Cotton
Published on 2010-06-07T10:06:16Z Indexed on 2010/06/07 10:12 UTC
Read the original article Hit count: 213

Filed under:
|
|

In order to be able to compare two versions of a package, I need to able to choose which version of the package that I load. R's package system is set to by default to overwrite existing packages, so that you always have the latest version. How do I override this behaviour?

My thoughts so far are:

I could get the package sources, edit the descriptions to give different names and build, in effect, two different packages. I'd rather be able to work directly with the binaries though, as it is much less hassle.

I don't necessarily need to have both versions of the packages loaded at the same time (just installed somewhere at the same time). I could perhaps mess about with Sys.getenv('R_HOME') to change the place where R installs the packages, and then .libpaths() to change the place where R looks for them. This seems hacky though, so does anyone have any better ideas?

© Stack Overflow or respective owner

Related posts about r

    Related posts about versioning