gmbecker / switchr

An R package for managing and seamlessly switching between sets of installed R packages.
http://google.com AND http://blabla.com
59 stars 6 forks source link

add .removePkg() helper #13

Closed vobencha closed 5 years ago

vobencha commented 5 years ago

This pull request adds a helper function that removes a package from a GRANRepository object. Intended as a sister function to addPkg() using primarily during testing to remove test packages. Not exported.

When removing a package from a GRANRepository object that has gone through a build cycle should we also remove old build products or run clear_repo()?

vobencha commented 5 years ago

@gmbecker ,

.removePkg() was added to switchr was because I viewed it as a sister function to addPkg(). I agree since switchr doesn't import GRANRepository objects this is probably not the best place for it. Also agree that it shouldn't be a generic or exported. Since addPkg,GRANRepository-method is defined in gRAN, that seems the more appropriate place.

As I understand it, GRANRepository objects (or just the manifest) from older builds of R are often used to bootstrap new builds. This can result in repo.R containing information on packages that never built under the new version of R. In other words, there is no historical reproducibility value associated. The packages may have been deprecated, renamed or just not applicable to the new version. It seems reasonable to provide some tools for cleaning the repository object if only to the more experienced developer.

One of the motivations for this helper was that I could not find documentation of the allowed/expected relationship between the components of a GRANRepository object. If a package is in the manifest should it also be in the results? If it's in the suspended list should it also be in the manifest etc. AFAICT there are no validity checks to this effect so maybe all combinations are considered valid? I can think of justifiable cases for a few of these combos but not all. If this is documented and I've missed it please point me to it.

vobencha commented 5 years ago

Pull request was moved to gRAN. Closing this request.