From h.wickham at gmail.com  Wed Jan 31 05:39:14 2018
From: h.wickham at gmail.com (Hadley Wickham)
Date: Tue, 30 Jan 2018 20:39:14 -0800
Subject: [Rd] Best practices in developing package: From a single file
In-Reply-To: <a8fbf26f-5a4c-3526-68a5-e062a596313c@gmail.com>
References: <CAPtbhHwLXvdCX+1PJvEAyjWtcaVf=k4kL2fgXNhxLqfBhoJg-Q@mail.gmail.com>
 <1517329742.15543.15.camel@braverock.com>
 <aef83954-b118-6f8f-6d4f-d2a9758121cc@gmail.com>
 <CY4PR2001MB10641A6B87B06111469FDBD0BEE40@CY4PR2001MB1064.namprd20.prod.outlook.com>
 <23152.57287.697853.990831@rob.eddelbuettel.com>
 <CAPekMCkWYvdGJ=wXA3bGFs655xsV6RUFCCjFpcpZ4rjmB8u-VQ@mail.gmail.com>
 <a8fbf26f-5a4c-3526-68a5-e062a596313c@gmail.com>
Message-ID: <CABdHhvGGCpjFa-dPiK6fHLfVzCzZ3PboGSH9c8Jy+daW14vSNg@mail.gmail.com>

On Tue, Jan 30, 2018 at 4:55 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 30/01/2018 4:30 PM, Kenny Bell wrote:
>>
>> In response to Duncan regarding the use of roxygen2 from the point of view
>> of a current user, I believe the issue he brings up is one of correlation
>> rather than causation.
>
>
> Could be.  However, I think editing comments in a .R file is a bit harder
> than editing text in a .Rd file, so I think the format discourages editing.
> I think it does make it easier to pass R CMD check the first time, but I
> don't think you should be satisfied with that.

One counter-point: I find it much easier to remember to update the
documentation when you update the code, if the code and the
documentation are very close together. I think mingling code and
documentation in the same file does add a subtle pressure to write
shorter docs, but I'm not entirely sure that's a bad thing - for long
form writing, vignettes are a much better solution anyway (since you
often want to mingle code and explanation).

Personally, I don't find writing in comments any harder than writing
in .Rd files, especially now that you can write in markdown and have
it automatically translated to Rd formatting commands.  And on the
negative side of Rd, I find it frustrating to have to copy and paste
the function definition to the usage section every time I modify an
argument. It just feels like unnecessary busywork that the computer
should be able to do for me (although I do understand why it is not
possible).

>> Writing my first piece of R documentation was made much easier by using
>> roxygen2, and it shallowed the learning curve substantially.
>
> I'm not completely up to date on Roxygen2 these days:  can you do some pages
> in Rd, others in Roxygen?  That's not quite as good as being able to switch
> back and forth, but it would allow you to start in Roxygen, then gradually
> move to Rd when editing there was easier.

Yes, that's possible, and to protect you in mixed environment,
roxygen2 will never overwrite a file that it did not itself create.

Hadley

-- 
http://hadley.nz



[Rd] Best practices in developing package: From a single file
Hadley Wickham