From murdoch.duncan at gmail.com  Mon Oct  5 01:52:36 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sun, 4 Oct 2015 19:52:36 -0400
Subject: [Rd] Conditional importFrom (roxygen?)
In-Reply-To: <loom.20151005T013053-407@post.gmane.org>
References: <CABG0rfu+kdrgWsyQPyJf-Twm2ostSCsMi7vbzR5br9LoPtmbLw@mail.gmail.com>
	<5611526D.7080508@gmail.com> <loom.20151005T013053-407@post.gmane.org>
Message-ID: <5611BBC4.2030307@gmail.com>

On 04/10/2015 7:34 PM, Ben Bolker wrote:
> Duncan Murdoch <murdoch.duncan <at> gmail.com> writes:
> 
>>
>> On 04/10/2015 10:10 AM, Jonathan Greenberg wrote:
>>> Folks:
>>>
> 
> [snip snip snip]
> 
>>>
>>> Is there a way to do a conditional importFrom based on the OS?  Or can I
>>> safely ignore this (I'm trying to submit to CRAN).
>>>
>>
>> Yes, you can put conditionals into the NAMESPACE file.  Apparently
>> roxygen2 doesn't support this feature, so you'll have to do it by hand.
>>
>> Duncan Murdoch
>>
>>
> 
> This has been submitted as an issue at
> 
> https://github.com/klutometis/roxygen/issues/378
> 
> closely related:
> 
> https://github.com/klutometis/roxygen/issues/371
> 
> my current hacky solution to this is to use a Makefile that
> post-processes the NAMESPACE after it's roxygenized, e.g. search
> for "getRversion" in
> 
> https://github.com/glmmTMB/glmmTMB/blob/master/Makefile

Hadley has the right idea (allow roxygen to specify some uninterpreted
text to drop into the NAMESPACE file), but it doesn't go far enough.
Really this is a design flaw in roxygen:  being able to enter NAMESPACE
and help page info in source files is a great feature, but being forced
to go all or nothing is a flaw.

If base R adds something new to the NAMESPACE or .Rd files (or has some
obscure feature that roxygen authors didn't notice), it's really hard
for roxygen users to make use of it.

A better design would be to allow content from both sources:  some
manually entered NAMESPACE stuff, and some automatically generated stuff.

A really nice design would be to read the manually entered stuff and
show (some of?) it in the .R files, but that would be really tricky to
get right.  I think it would need to be supported by a GUI, it wouldn't
be reasonable to expect people to type it all properly in a dumb editor.
 Maybe Hadley knows someone who has written a GUI?

Duncan Murdoch



[Rd] Conditional importFrom (roxygen?)
Duncan Murdoch