[R] exporting list of installed packages for import on another system?

Jan Theodore Galkowski disneylogic at fastmail.fm
Tue Jul 14 17:57:06 CEST 2009


Super Marc! Thanks!

Should I post this on the R Wiki some place? 'Twould be useful to others,  
I think.

  - Jan

On Tue, 14 Jul 2009 11:49:49 -0400, Marc Schwartz <marc_schwartz at me.com>  
wrote:

> On Jul 14, 2009, at 9:43 AM, Jan Theodore Galkowski wrote:
>
>> Is it possible to export a list of installed packages from WinXP, and
>> use that export to import the same set of packages on Ubuntu (Jaunty)?
>> No doubt
>> there is custom code that could be written, but I wonder if R 2.9.1 has
>> anything built it to do that?  Is it as simple as moving something like
>> Rprofile.site from one machine to the other?
>>
>> I had a look at R-admin.pdf, and although it talks a lot about
>> configuring on various systems, it did not address this directly.  Also
>> looked at RSeek.
>>
>> Thanks.
>
>
> If you are just going to replicate a standard installation with Base and  
> Recommended packages, then just install R on Ubuntu (I presume that you  
> will use 'apt-get'"?) and you will have the same. Review the following  
> for more Ubuntu specific information:
>
>    http://cran.r-project.org/bin/linux/ubuntu/
>
>
> If there are extra packages that you have installed on Windows, then you  
> can use the following to get the list:
>
> IP <- as.data.frame(installed.packages())
>
> MyPkgs <- subset(IP, !Priority %in% c("base", "recommended"), select =  
> c(Package, Bundle))
>
>
> MyPkgs will now contain a list (first column) of the packages that you  
> have installed that are not part of the basic R install. In addition,  
> pay attention to the 'Bundle' column in case you have installed any  
> package bundles. Those would need to be installed using the Bundle name  
> and not the individual package name.
>
> Before you go too far with this however, I would check to see just how  
> many packages are listed in MyPkgs. If the list is short (for some value  
> of short), you may be better just manually installing the packages on  
> your Ubuntu system rather than going through this process.
>
> The question then becomes, are you going to install these on Ubuntu  
> using 'apt-get' from the Ubuntu CRAN repos, or are you going to install  
> the packages from CRAN using install.packages(). I suppose intertwined  
> with that will be are there any packages that you have installed that  
> are not yet in the Ubuntu repos.
>
> In either case, you can save 'MyPkgs' to an R readable object file on  
> Windows by using:
>
>    save(MyPkgs, "MyPkgs.Rdata")
>
> Copy that file over to your Ubuntu installation and use:
>
>    load("MyPkgs.Rdata")
>
> and you will have the MyPkgs object available there.
>
> You can then use the list as you require.
>
> If you are going to use install.packages() and presuming that you do not  
> have any bundles installed on your Windows system, you could do the  
> following after using 'sudo R' to go into R:
>
>    load("MyPkgs.Rdata")
>
>    install.packages(MyPkgs$Package, dependencies = TRUE)
>
>
> If you are going to use 'apt-get', I would read the following as I noted  
> above:
>
>    http://cran.r-project.org/bin/linux/ubuntu/
>
>
> You could feasibly create an 'apt-get' command line call using paste()  
> and the system() functions along the lines of:
>
>    CMD <- sapply(MyPkgs$Package, function(x) paste("r-cran-", x, sep =  
> ""))
>    CMD <- paste(CMD, collapse = " ")
>    CMD <- paste("apt-get", CMD)
>
> and then use:
>
>    system(CMD)
>
> after using 'sudo R' to get into R.
>
> However, I would recommend that you consider posting a query to the r- 
> sig-debian list just to verify all of the above. More info at:
>
>    https://stat.ethz.ch/mailman/listinfo/r-sig-debian
>
> HTH,
>
> Marc Schwartz
>



-- 

   Jan Theodore Galkowski
   bayesianlogic at acm.org
   http://www.ekzept.net
   16072391834

"Eppur si muove." --Galilei




More information about the R-help mailing list