gesistsa / rang

🐶 (Re)constructing R computational environments
https://gesistsa.github.io/rang/
GNU General Public License v3.0
79 stars 3 forks source link

Reconstruct Packages Based on the API Usage in a File #169

Closed EagleoutIce closed 1 year ago

EagleoutIce commented 1 year ago

The way i understand this package is that it can give me the latest version of packages at a point in time. However (assuming that is the case), just because I have a script from a given point in time does not mean that the respective researcher used the (at-the-time) latest version.

For my use-case (running older R scripts) it would be really great if the package could analyze the Package/API usage and from that reconstruct all potential package versions at a given point in time.

Is something like that planned? Or maybe even already possible (and I just missed it)?

chainsawriot commented 1 year ago

@EagleoutIce Unfortunately, it is not possible with the current iteration of rang to do static code analysis to extract all functions used in a script and match that with multiple versions of packages' APIs. It is the same as Posit Public Package Manager or the more recent evercran.

For new code, I recommend using renv to record the exact version of each R package. For old code, the reconstructed computational environment from rang can be a starting point for one to try to run the old code on. If that only code really can't run, the error messages would prompt which package might have been too new. One can then edit the rang.R to use an older version of that package.