Søren Højsgaard
2012-Oct-02 20:18 UTC
[R] Having two different versions of a package in the same R installation
Dear list, I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R installation such that I can run a code chunk on one lme4 version and immediately after run the same code chunk on another lme4 version. Does anyone know if this is possible? Best regards S?ren
Greg Snow
2012-Oct-02 20:26 UTC
[R] Having two different versions of a package in the same R installation
So if you have both loaded in the same instance of R, how will R know which version of lmer or other functions that you want to run? It seems cleanest to me to have the 2 different instances of R running like you do now. The other option would be to change all the names (exported ones anyways) in one version and change that package name as well. Then you would have 2 different package names with different exported function names. On Tue, Oct 2, 2012 at 2:18 PM, S?ren H?jsgaard <sorenh at math.aau.dk> wrote:> Dear list, > > I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R installation such that I can run a code chunk on one lme4 version and immediately after run the same code chunk on another lme4 version. Does anyone know if this is possible? > > Best regards > S?ren > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
Henrik Bengtsson
2012-Oct-02 20:49 UTC
[R] Having two different versions of a package in the same R installation
Install the two versions in two different *libraries* and update .libPaths() to prioritize one over the other. /Henrik On Tue, Oct 2, 2012 at 1:18 PM, S?ren H?jsgaard <sorenh at math.aau.dk> wrote:> Dear list, > > I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R installation such that I can run a code chunk on one lme4 version and immediately after run the same code chunk on another lme4 version. Does anyone know if this is possible? > > Best regards > S?ren > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Gabor Grothendieck
2012-Oct-02 20:53 UTC
[R] Having two different versions of a package in the same R installation
On Tue, Oct 2, 2012 at 4:18 PM, S?ren H?jsgaard <sorenh at math.aau.dk> wrote:> Dear list, > > I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R installation such that I can run a code chunk on one lme4 version and immediately after run the same code chunk on another lme4 version. Does anyone know if this is possible? >Install the two versions into two different R libraries: install.packages("my.package", repos = ..., lib = ...) # 1st repo/lib install.packages("my.package", repos = ..., lib = ...) # 2nd repo/lib library(my.package, lib.loc = ...) # 1st lib # use it detach(my.package, unload = TRUE) # next line may or may not be needed library.dynam.unload("my.package", system.file(package = "my.package")) library(my.package, lib.loc = ...) # 2nd lib -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Dirk Eddelbuettel
2012-Oct-02 20:58 UTC
[R] Having two different versions of a package in the same R installation
On 2 October 2012 at 20:18, S?ren H?jsgaard wrote: | I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R installation such that I can run a code chunk on one lme4 version and immediately after run the same code chunk on another lme4 version. Does anyone know if this is possible? If you use different directories both versions can be installed at the same time. The one being found first when going down .libPaths() is the default, the other can be loaded by supplying the path to library(). Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com