From Robert.McGehee at geodecapital.com  Thu Apr 18 19:42:52 2013
From: Robert.McGehee at geodecapital.com (McGehee, Robert)
Date: Thu, 18 Apr 2013 13:42:52 -0400
Subject: [Rd] Rebuild package on R 3.0.0 without source code?
In-Reply-To: <517010F9.5030305@stats.ox.ac.uk>
References: <17B09E7789D3104E8F5EEB0582A8D66FF25B068C6A@MSGRTPCCRF2WIN.DMN1.FMR.COM>
	<517010F9.5030305@stats.ox.ac.uk>
Message-ID: <17B09E7789D3104E8F5EEB0582A8D66FF25B147D08@MSGRTPCCRF2WIN.DMN1.FMR.COM>

Very nice, thank you! The steps did work. Documentation, demos, examples, functions, external data all load perfectly. For the archive, the step "make ... the correct DESCRIPTION file" only involved copying the binary's DESCRIPTION file and removing the last line ("Built: R 2.14.1...").

To answer Marc's question, the package is not in cran as it's a closed-source R interface package to a proprietary optimization software written in Java (Axioma). I wanted the flexibility to upgrade R even if the vendor decides not to release a new binary package anytime soon. To Duncan's point, agreed! Personally, I generally prefer the open-source optimizers as you can throw tons of CPUs at the problem without running out of software licenses. However, this particular proprietary optimizer is very good at solving quadratically constrained quadratic programs (QCQP), and I haven't yet seen a free R package that can solve this kind of problem (e.g. max q'x - x'Qx subject to x'Qx <= B and Ax=c).

Thanks again!
Robert

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Thursday, April 18, 2013 11:28 AM
To: McGehee, Robert
Cc: R-Devel (r-devel at r-project.org)
Subject: Re: [Rd] Rebuild package on R 3.0.0 without source code?

On 18/04/2013 16:07, McGehee, Robert wrote:
> R-developers,
> I have a binary R package built using R 2.14.1 that I would like to run on R 3.0.0. Unfortunately, the original source code is unavailable, so I cannot rebuild the package as R 3.0.0 requires.
>
> Is there a straight forward way of converting the package (.rdb, .rdx and .rds files) in the binary package from a 2.14.1 version to a 3.0.0 version without the source code (perhaps uncompressing/recompressing somehow)?
>
> Naturally, since the R code is visible, I know I can output all of the parsed objects in the package to a text file to make a skeleton package that can then be built/installed. Something like this:
>
>         objs <- ls(envir=loadNamespace("binaryPkg"), all.names=TRUE)
>         dump(objs, file="code.R", envir=loadNamespace("binaryPkg"))
>
> However, I'd still lose all the man pages, and since I get a couple of "deparse may be incomplete" warnings, I worry that this may be introducing additional bugs.
>
> Is there a magic solution here, or is this a fool's errand?

No magic solution, and the following may not work, but it might.

Make a simple package with the correct DESCRIPTION file.  Install that 
somewhere new.  Then use the installed DESCRIPTION file and 
Meta/package.rds to replace the versions you got from 2.14.1.


It is possible to extract the man pages: the key step is 
tools:::fetchRdDB.  On my system

names(tools:::fetchRdDB('/Users/ripley/R/R-devel/library/MASS/help/MASS'))
tools:::fetchRdDB('/Users/ripley/R/R-devel/library/MASS/help/MASS', 'rlm')

work: the layout of the pages is a little odd.



>
> Thanks, Robert
>
> Robert McGehee, CFA
> Geode Capital Management, LLC
> One Post Office Square, 28th Floor | Boston, MA | 02109
> Direct: (617)392-8396
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Rebuild package on R 3.0.0 without source code?
McGehee, Robert