update of a R package which is lazy loaded

2019-08-06 22:50发布

问题:

I have several unix servers using a R package which is installed on a shared R library folder. The packages are lazy loaded (that's the default) from this shared folder.

Now I want to update the package:

1) is it possible (and clean) to do that without closing all R instances?

2) More precisely, I am concerned about the following:
2)a) The warning I get from the user interface when I try to install a package that is already loaded:
2)b) From https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Lazy-loading,

When a package/namespace which uses it is loaded, the package/namespace environment is populated with promises for all the named objects: when these promises are evaluated they load the actual code from a database.

Does that mean that the R instance will read again from the library folder when doing the actual evaluation of each object (in which case that means I need to either deactivate the lazy loading, or close all R instances before updating the package)

3) is there an alternative way to maintain R packages on a network of servers, that are running scripts all the time, without having to put each server offline one by one)

Thanks for your input

回答1:

You asked

1) is it possible (and clean) to do that without closing all R instances?

and I can assure that yes, that it is how works and done everywhere.

As for

2) More precisely, I am concerned about the following:

you are reading it wrong. An R restart is simply recommended to ensure the new package is loaded as you cannot insert it into a running session.

Further

3) is there an alternative way to maintain R packages on a network of servers, that are running scripts all the time, without having to put each server offline one by one)

you never have to take a server off-line just to update a user-space package. E.g. we don't even take them off-line when we, say, upgrade the entire Ubuntu release twice a year.