I work for an organization with a number of internal R packages, all written many years ago. These are stored as .zip
archives built on Windows under R 3.x. They cannot be loaded on Linux or macOS or under R 4.y without being rebuilt. Unfortunately, I do not have access to the package sources. They are lost to time...
I want to take these binaries, extract the source code, and repackage it according to current best practices (version control, roxygen2, testthat, etc.). What is the best way to do that?
I have already tackled one of the binaries by:
- Manually copying the source code of objects (exported and internal functions, data sets, etc.) in the loaded namespace to new
.R
files. - Manually adding Roxygen blocks to the
.R
files in order to reproduce the help pages as displayed in the browser.
I am partly stuck at (1) because some of the functions are S4 generic. dput(<name>)
gives new("standardGeneric", ...)
as opposed to a simple function
definition. Otherwise, the process has been fairly straightforward, but very time consuming.
Is there a way to programmatically "back engineer" source files from R package binaries, while handling S4 generic functions, classes, and methods correctly?
Everyone in the organization will be stuck on R 3.6 until this problem is resolved.