title: "Back engineering" an R package from compiled binary version
body: <p>I work for an org that has a number of internal packages that were created many years ago. These are in the form of package zip archives that were compiled on Windows on <code>R 3.x</code>. Therefore, they can't be installed on <code>R 4.x</code>, and can't be used on Macs or Linux either without being recompiled. So everyone in the entire org is stuck on <code>R 3.6</code> until this is resolved. I don't have access to the original package source files. They are lost to time....</p>
  <p>I want to take these packages, extract the code and data, and update them for modern best practices (<code>roxygen</code>, GitHub repos, <code>testthat</code> etc.). What is the best way of doing this? I have a fair amount of experience with package development.  I have already tackled one. I started a new RStudio package project, and going function by function, copying the function code to a new script file, getting and reformatting the help from the help browser as roxygen docs. I've done the same for any internal hidden functions that i could find (via <code>pkg_name:::</code> mostly) , and also the internal datasets. That is all fairly straightforward, but <em>very</em> time consuming.  It builds ok, but I haven't yet tested the actual functionality of the code.</p>
  <p>I'm currently stuck because there are a couple of <code>standardGeneric</code> method functions for custom S4 class objects. I am completely unfamiliar with these and haven't been able to figure out how to copy them over. Viewing the source code they are wrapped in <code>new()</code>  with <code>&quot;standardGeneric&quot;</code> as the first argument (plus a lot more obviously), as opposed to just being a simple <code>function</code> definition for all the other functions.  Any help with how to recreate or copy these over would be very welcome.</p>
  <p>But maybe I am going about this the wrong way in the first place. I haven't been able to find any helpful suggestions about how to &quot;back engineer&quot; R package source files from a compiled version.</p>
  <p>Anyone any ideas?</p>