[R-pkg-devel] Is it possible to reverse engineer a package from the installed library directory ?
Joshua Ulrich
josh.m.ulrich at gmail.com
Thu Mar 24 06:53:25 CET 2016
On Wed, Mar 23, 2016 at 9:25 PM, Ben Bolker <bbolker at gmail.com> wrote:
>
> You could take your old install and do this:
>
> library("your_package")
> funs <- ls(pos="package:your_package")
> dump(funs,"your_package.R")
>
> that wouldn't recreate documentation, NAMESPACE files, etc., but it would
> be a start.
>
You might be able to recreate the Rd files using the answers to this
StackOverflow question: http://stackoverflow.com/q/7493843/271616
Using the example in my answer as a starting point:
sink(file="survey.Rd")
utils:::.getHelpFile(as.character(help(survey,package="MASS")))
sink()
It might still need some formatting clean-up, but hopefully that gets
you 80-90% of the solution.
>
> On 16-03-23 04:43 PM, Paul Hurley wrote:
>>
>> Several years ago I assembled some of my own most used code into a
>> package,
>> and had that installed on my machine. Since then I have lost the source
>> files, but still have the package installed in an old v2.x R installation.
>>
>> I now need to use the package in my current R install, which is v3.1, and
>> won't let me just copy the directory across, as it complains it was build
>> pre v3. Is it possible to reverse engineer a package back to R source
>> files so I can then rebuild it in a new package ?
>>
>> Thanks
>>
>> Paul.
>>
>> --http://www.paulhurley.co.uk
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2016 | www.rinfinance.com
More information about the R-package-devel
mailing list