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
Having two different versions of a package in the same R installation
7 messages · Greg Snow, Søren Højsgaard, Henrik Bengtsson +3 more
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
I don't know if it would work but a kludgy attempt would be to install lme4 from CRAN, rename the lme4 directory in library to lme4cran; then install lme4 from R-forge and rename the lme4 directory to lme4forge. Then create a script flexible script that would copy one of the directories to a directory called lme4 on the fly. I don't know if it would work, but I just wonder if there would possibly a more elegant way. Regards S?ren -----Original Message----- From: Greg Snow [mailto:538280 at gmail.com] Sent: 2. oktober 2012 22:27 To: S?ren H?jsgaard Cc: r-help at r-project.org Subject: Re: [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
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.
On 02/10/2012 21:38, S?ren H?jsgaard wrote:
I don't know if it would work but a kludgy attempt would be to install lme4 from CRAN, rename the lme4 directory in library to lme4cran; then install lme4 from R-forge and rename the lme4 directory to lme4forge. Then create a script flexible script that would copy one of the directories to a directory called lme4 on the fly. I don't know if it would work, but I just wonder if there would possibly a more elegant way.
Do you want them installed or loaded? For installation, simply use different library directories, and adjust .libPaths. You won't succeed in loading them together: the insuperable problem is not the R functions (they could be in different environments) but the DLLs (you can only load one DLL of a given name). We've been here with versioned installs, which were abandoned a long while ago (not least as we never had versioned namespaces).
Regards S?ren -----Original Message----- From: Greg Snow [mailto:538280 at gmail.com] Sent: 2. oktober 2012 22:27 To: S?ren H?jsgaard Cc: r-help at r-project.org Subject: Re: [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
______________________________________________ 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.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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
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