Synchronizing R libraries on N machines?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Synchronizing R libraries on N machines?

Giovanni Petris
Hello!

I am using R on two different machines (under Ubuntu and OS X, but this
is probably irrelevant) and I would like to keep the two installations
'synchronized', in particular in terms of installed packages. For
example, if I install package xxx on my Linux machine, I would like to
find it installed also on my Mac, and vice versa.

I imagine this to be a fairly common problem, so I would like to ask if
anybody has suggestions to share about it. Is there a way to make the
synchronization automatic? Painless?

Thank you in advance for the suggestions.

Best,
Giovanni


--

Giovanni Petris  <[hidden email]>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

Rainer M Krug-6
On Thu, Aug 25, 2011 at 3:25 PM, Giovanni Petris <[hidden email]> wrote:

> Hello!
>
> I am using R on two different machines (under Ubuntu and OS X, but this
> is probably irrelevant) and I would like to keep the two installations
> 'synchronized', in particular in terms of installed packages. For
> example, if I install package xxx on my Linux machine, I would like to
> find it installed also on my Mac, and vice versa.
>
> I imagine this to be a fairly common problem, so I would like to ask if
> anybody has suggestions to share about it. Is there a way to make the
> synchronization automatic? Painless?
>

library()$result[,1] returns the names of the installed packages. If you do
this on one machine, then compare it with the same outpout on the other
machine, you can identify the packages which are not installed, and you can
install those.

e.g.:
x <- letters[1:10]
y <- letters[5:20]
lx[!(x %in% y)]

returns
"a" "b" "c" "d"

which are in x, but not y.

Hope this helps,

Rainer

returns the letters which are in

>
> Thank you in advance for the suggestions.
>
> Best,
> Giovanni
>
>
> --
>
> Giovanni Petris  <[hidden email]>
> Associate Professor
> Department of Mathematical Sciences
> University of Arkansas - Fayetteville, AR 72701
> Ph: (479) 575-6324, 575-8630 (fax)
> http://definetti.uark.edu/~gpetris/
>
> ______________________________________________
> [hidden email] 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.
>



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

Giovanni Petris
Hi Rainer,

This certainly helps, but it still requires to do some work by hand. I
was hoping for something more automatic - but so far nobody has
suggested a better approach.

Thank you,
Giovanni


On Thu, 2011-08-25 at 15:43 +0200, Rainer M Krug wrote:

>
>
> On Thu, Aug 25, 2011 at 3:25 PM, Giovanni Petris <[hidden email]>
> wrote:
>         Hello!
>        
>         I am using R on two different machines (under Ubuntu and OS X,
>         but this
>         is probably irrelevant) and I would like to keep the two
>         installations
>         'synchronized', in particular in terms of installed packages.
>         For
>         example, if I install package xxx on my Linux machine, I would
>         like to
>         find it installed also on my Mac, and vice versa.
>        
>         I imagine this to be a fairly common problem, so I would like
>         to ask if
>         anybody has suggestions to share about it. Is there a way to
>         make the
>         synchronization automatic? Painless?
>
>
> library()$result[,1] returns the names of the installed packages. If
> you do this on one machine, then compare it with the same outpout on
> the other machine, you can identify the packages which are not
> installed, and you can install those.
>
>
> e.g.:
> x <- letters[1:10]
> y <- letters[5:20]
> lx[!(x %in% y)]
>
>
> returns
> "a" "b" "c" "d"
>
>
> which are in x, but not y.
>
>
> Hope this helps,
>
>
> Rainer
>
>
> returns the letters which are in
>        
>         Thank you in advance for the suggestions.
>        
>         Best,
>         Giovanni
>        
>        
>         --
>        
>         Giovanni Petris  <[hidden email]>
>         Associate Professor
>         Department of Mathematical Sciences
>         University of Arkansas - Fayetteville, AR 72701
>         Ph: (479) 575-6324, 575-8630 (fax)
>         http://definetti.uark.edu/~gpetris/
>        
>         ______________________________________________
>         [hidden email] 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.
>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax (F):       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

Rainer M Krug-6
On Fri, Aug 26, 2011 at 3:05 PM, Giovanni Petris <[hidden email]> wrote:

> Hi Rainer,
>
> This certainly helps, but it still requires to do some work by hand. I
> was hoping for something more automatic - but so far nobody has
> suggested a better approach.
>

Well - you could define two scripts, one which is executed when opening R
(.First() I think) and one executed last (.Last()) - the .Last could write
the list of packages installed into a dropbox folder, and the .First could
read the one from the dropbox folder from the other machine, compare it with
the installed packages and install the new ones. So you only need a dropbox
or similar accout - or you could write it to a USB drive and do the same.

So you can automate it relatively easily, but somehow you have to bring the
list of installed packages to the other machine before starting R.

Cheers,

Rainer


> Thank you,
> Giovanni
>
>
> On Thu, 2011-08-25 at 15:43 +0200, Rainer M Krug wrote:
> >
> >
> > On Thu, Aug 25, 2011 at 3:25 PM, Giovanni Petris <[hidden email]>
> > wrote:
> >         Hello!
> >
> >         I am using R on two different machines (under Ubuntu and OS X,
> >         but this
> >         is probably irrelevant) and I would like to keep the two
> >         installations
> >         'synchronized', in particular in terms of installed packages.
> >         For
> >         example, if I install package xxx on my Linux machine, I would
> >         like to
> >         find it installed also on my Mac, and vice versa.
> >
> >         I imagine this to be a fairly common problem, so I would like
> >         to ask if
> >         anybody has suggestions to share about it. Is there a way to
> >         make the
> >         synchronization automatic? Painless?
> >
> >
> > library()$result[,1] returns the names of the installed packages. If
> > you do this on one machine, then compare it with the same outpout on
> > the other machine, you can identify the packages which are not
> > installed, and you can install those.
> >
> >
> > e.g.:
> > x <- letters[1:10]
> > y <- letters[5:20]
> > lx[!(x %in% y)]
> >
> >
> > returns
> > "a" "b" "c" "d"
> >
> >
> > which are in x, but not y.
> >
> >
> > Hope this helps,
> >
> >
> > Rainer
> >
> >
> > returns the letters which are in
> >
> >         Thank you in advance for the suggestions.
> >
> >         Best,
> >         Giovanni
> >
> >
> >         --
> >
> >         Giovanni Petris  <[hidden email]>
> >         Associate Professor
> >         Department of Mathematical Sciences
> >         University of Arkansas - Fayetteville, AR 72701
> >         Ph: (479) 575-6324, 575-8630 (fax)
> >         http://definetti.uark.edu/~gpetris/
> >
> >         ______________________________________________
> >         [hidden email] 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.
> >
> >
> >
> >
> > --
> > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> > Biology, UCT), Dipl. Phys. (Germany)
> >
> > Centre of Excellence for Invasion Biology
> > Stellenbosch University
> > South Africa
> >
> > Tel :       +33 - (0)9 53 10 27 44
> > Cell:       +33 - (0)6 85 62 59 98
> > Fax (F):       +33 - (0)9 58 10 27 44
> >
> > Fax (D):    +49 - (0)3 21 21 25 22 44
> >
> > email:      [hidden email]
> >
> > Skype:      RMkrug
> >
>
>
>


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

IAIN GALLAGHER
In reply to this post by Giovanni Petris
Hi Giovanni

Using Ubuntu and MacOSX may not be irrelevant. I use Ubuntu and if I carry out a fresh install (e.g. after a new release - although I've stuck with 10.04 so far) then I always have to mess around, check the web etc to install external packages that R libraries I want to use rely on.

A good example would be libxml2-dev (which doesn't appear if you use Synaptic and search for xml2 - sigh) for using biomaRt etc etc.

Just a heads up that the external software some R libraries rely on might not be installed on both systems. So installing a package on one system sucessfully doesn't mean you can alway expect it to install without incident on another.

Best

iain

--- On Fri, 26/8/11, Giovanni Petris <[hidden email]> wrote:

> From: Giovanni Petris <[hidden email]>
> Subject: Re: [R] Synchronizing R libraries on N machines?
> To: "Rainer M Krug" <[hidden email]>
> Cc: [hidden email]
> Date: Friday, 26 August, 2011, 14:05
> Hi Rainer,
>
> This certainly helps, but it still requires to do some work
> by hand. I
> was hoping for something more automatic - but so far nobody
> has
> suggested a better approach.
>
> Thank you,
> Giovanni
>
>
> On Thu, 2011-08-25 at 15:43 +0200, Rainer M Krug wrote:
> >
> >
> > On Thu, Aug 25, 2011 at 3:25 PM, Giovanni Petris
> <[hidden email]>
> > wrote:
> >         Hello!
> >         
> >         I am using R on
> two different machines (under Ubuntu and OS X,
> >         but this
> >         is probably
> irrelevant) and I would like to keep the two
> >         installations
> >         'synchronized',
> in particular in terms of installed packages.
> >         For
> >         example, if I
> install package xxx on my Linux machine, I would
> >         like to
> >         find it
> installed also on my Mac, and vice versa.
> >         
> >         I imagine this
> to be a fairly common problem, so I would like
> >         to ask if
> >         anybody has
> suggestions to share about it. Is there a way to
> >         make the
> >         synchronization
> automatic? Painless?
> >
> >
> > library()$result[,1] returns the names of the
> installed packages. If
> > you do this on one machine, then compare it with the
> same outpout on
> > the other machine, you can identify the packages which
> are not
> > installed, and you can install those.
> >
> >
> > e.g.:
> > x <- letters[1:10]
> > y <- letters[5:20]
> > lx[!(x %in% y)]
> >
> >
> > returns
> > "a" "b" "c" "d"
> >
> >
> > which are in x, but not y.
> >
> >
> > Hope this helps,
> >
> >
> > Rainer
> >
> >
> > returns the letters which are in
> >         
> >         Thank you in
> advance for the suggestions.
> >         
> >         Best,
> >         Giovanni
> >         
> >         
> >         --
> >         
> >         Giovanni
> Petris  <[hidden email]>
> >         Associate
> Professor
> >         Department of
> Mathematical Sciences
> >         University of
> Arkansas - Fayetteville, AR 72701
> >         Ph: (479)
> 575-6324, 575-8630 (fax)
> >         http://definetti.uark.edu/~gpetris/
> >         
> >     
>    ______________________________________________
> >         [hidden email]
> 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.
> >
> >
> >
> >
> > --
> > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc
> (Conservation
> > Biology, UCT), Dipl. Phys. (Germany)
> >
> > Centre of Excellence for Invasion Biology
> > Stellenbosch University
> > South Africa
> >
> > Tel :       +33 - (0)9 53 10
> 27 44
> > Cell:       +33 - (0)6 85 62
> 59 98
> > Fax (F):       +33 - (0)9 58
> 10 27 44
> >
> > Fax (D):    +49 - (0)3 21 21 25 22 44
> >
> > email:      [hidden email]
> >
> > Skype:      RMkrug
> >
>
> ______________________________________________
> [hidden email]
> 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

Rainer M Krug-6
On Fri, Aug 26, 2011 at 3:45 PM, Iain Gallagher <
[hidden email]> wrote:

> Hi Giovanni
>
> Using Ubuntu and MacOSX may not be irrelevant. I use Ubuntu and if I carry
> out a fresh install (e.g. after a new release - although I've stuck with
> 10.04 so far) then I always have to mess around, check the web etc to
> install external packages that R libraries I want to use rely on.
>
> A good example would be libxml2-dev (which doesn't appear if you use
> Synaptic and search for xml2 - sigh) for using biomaRt etc etc.
>
> Just a heads up that the external software some R libraries rely on might
> not be installed on both systems. So installing a package on one system
> sucessfully doesn't mean you can alway expect it to install without incident
> on another.
>

Absolutely - and I have also ignored the question of how the packages should
be installed - I opted for install.packages, but there is also the apt-get
way for some packages. So there is sometimes the need to add dependencies
via apt-get / synaptic, and if apt-get should be used to install the
packages, my script idea also would fail.
But when using install.packages(), it should mainly automate the task.

Cheers,

Rainer


>
> Best
>
> iain
>
> --- On Fri, 26/8/11, Giovanni Petris <[hidden email]> wrote:
>
> > From: Giovanni Petris <[hidden email]>
> > Subject: Re: [R] Synchronizing R libraries on N machines?
> > To: "Rainer M Krug" <[hidden email]>
> > Cc: [hidden email]
> > Date: Friday, 26 August, 2011, 14:05
> > Hi Rainer,
> >
> > This certainly helps, but it still requires to do some work
> > by hand. I
> > was hoping for something more automatic - but so far nobody
> > has
> > suggested a better approach.
> >
> > Thank you,
> > Giovanni
> >
> >
> > On Thu, 2011-08-25 at 15:43 +0200, Rainer M Krug wrote:
> > >
> > >
> > > On Thu, Aug 25, 2011 at 3:25 PM, Giovanni Petris
> > <[hidden email]>
> > > wrote:
> > >         Hello!
> > >
> > >         I am using R on
> > two different machines (under Ubuntu and OS X,
> > >         but this
> > >         is probably
> > irrelevant) and I would like to keep the two
> > >         installations
> > >         'synchronized',
> > in particular in terms of installed packages.
> > >         For
> > >         example, if I
> > install package xxx on my Linux machine, I would
> > >         like to
> > >         find it
> > installed also on my Mac, and vice versa.
> > >
> > >         I imagine this
> > to be a fairly common problem, so I would like
> > >         to ask if
> > >         anybody has
> > suggestions to share about it. Is there a way to
> > >         make the
> > >         synchronization
> > automatic? Painless?
> > >
> > >
> > > library()$result[,1] returns the names of the
> > installed packages. If
> > > you do this on one machine, then compare it with the
> > same outpout on
> > > the other machine, you can identify the packages which
> > are not
> > > installed, and you can install those.
> > >
> > >
> > > e.g.:
> > > x <- letters[1:10]
> > > y <- letters[5:20]
> > > lx[!(x %in% y)]
> > >
> > >
> > > returns
> > > "a" "b" "c" "d"
> > >
> > >
> > > which are in x, but not y.
> > >
> > >
> > > Hope this helps,
> > >
> > >
> > > Rainer
> > >
> > >
> > > returns the letters which are in
> > >
> > >         Thank you in
> > advance for the suggestions.
> > >
> > >         Best,
> > >         Giovanni
> > >
> > >
> > >         --
> > >
> > >         Giovanni
> > Petris  <[hidden email]>
> > >         Associate
> > Professor
> > >         Department of
> > Mathematical Sciences
> > >         University of
> > Arkansas - Fayetteville, AR 72701
> > >         Ph: (479)
> > 575-6324, 575-8630 (fax)
> > >         http://definetti.uark.edu/~gpetris/
> > >
> > >
> >    ______________________________________________
> > >         [hidden email]
> > 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.
> > >
> > >
> > >
> > >
> > > --
> > > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc
> > (Conservation
> > > Biology, UCT), Dipl. Phys. (Germany)
> > >
> > > Centre of Excellence for Invasion Biology
> > > Stellenbosch University
> > > South Africa
> > >
> > > Tel :       +33 - (0)9 53 10
> > 27 44
> > > Cell:       +33 - (0)6 85 62
> > 59 98
> > > Fax (F):       +33 - (0)9 58
> > 10 27 44
> > >
> > > Fax (D):    +49 - (0)3 21 21 25 22 44
> > >
> > > email:      [hidden email]
> > >
> > > Skype:      RMkrug
> > >
> >
> > ______________________________________________
> > [hidden email]
> > 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.
> >
>
> ______________________________________________
> [hidden email] 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.
>



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing R libraries on N machines?

Hans Ekbrand
In reply to this post by Giovanni Petris
On Thu, Aug 25, 2011 at 08:25:02AM -0500, Giovanni Petris wrote:

> Hello!
>
> I am using R on two different machines (under Ubuntu and OS X, but this
> is probably irrelevant) and I would like to keep the two installations
> 'synchronized', in particular in terms of installed packages. For
> example, if I install package xxx on my Linux machine, I would like to
> find it installed also on my Mac, and vice versa.
>
> I imagine this to be a fairly common problem, so I would like to ask if
> anybody has suggestions to share about it. Is there a way to make the
> synchronization automatic? Painless?
I have a number of machines in a home LAN that share /usr/local where
I have all but a few R-packages that are automatically installed by
the OS package-mangagement system (by installing the meta package
r-recommended).

I have the following snippet in my .Rprofile

lib.loc = "/usr/local/lib/R/site-library/"

so whenever a package is installed, all machines have access to it.

This will of course not work if the machines are running different
OS:es, so that is not irrelevant.

______________________________________________
[hidden email] 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.

signature.asc (205 bytes) Download Attachment