[R] Include pre-existing PDF files as vignettes in an R package?

Michael Hannon jmhannon.ucdavis at gmail.com
Mon Feb 19 11:44:25 CET 2018


Heh.  Thanks, Ista, for your diplomatically-phrased suggestion :-)  In
fact, I *did* read the "vignettes" section of the Extensions manual,
but evidently not closely enough.

Upon further review, I see that one can use
".../vignettes/.install_extras" to list additional files that should
be copied to ".../inst/doc/".  I tried that, and it seems to work, but
the files from .install_extras are not listed as vignettes.

Hence, this seems like a convenient way to distribute the additional
files.  I.e., we would be asking people to use
"devtools::install_github" to get the packages, but I still don't see
how to make the additional files readily available to the end user.

-- Mike

On Sun, Feb 18, 2018 at 6:15 PM, Ista Zahn <istazahn at gmail.com> wrote:
> Hi Mike,
>
> Did you read the relevant section of the official "Writing R
> Extensions" manual? If so, what about the instructions provided there
> do you find lacking?
>
> Best,
> Ista
>
> On Sun, Feb 18, 2018 at 9:06 PM, Michael Hannon
> <jmhannon.ucdavis at gmail.com> wrote:
>> Greetings.  The group that I work with has just started using the approach
>> outlined in Karl Broman's handy primer:
>>
>>     http://kbroman.org/pkg_primer/pages/vignettes.html
>>
>> to create vignettes for a couple of R packages.
>>
>> This works fine as long as we have a current Rmd version of the vignette.  But
>> we have some old PDF documents that we'd like to include as vignettes as well.
>> I'd like to know if there's a way to include such PDF files as vignettes.
>>
>> We *do* have the source files for the PDF files in question, but it would be
>> tedious to convert those source files to Rmd format.
>>
>> My first thought was simply to add the PDF files to the .../vignettes
>> subdirectory and run the devtools::build_vignettes() function (mentioned in
>> the Broman tutorial), but that doesn't work.  I.e., the PDF files don't appear
>> in the list of vignettes for the package.
>>
>> And after running devtools::build_vignettes I see that there's a lot of
>> additional stuff in:
>>
>>     ...lib/R/site-library/<package_name>/...
>>
>> so I don't see any obvious way to "fool" R into using the PDF files that
>> haven't gone through the whole knitr/rmarkdown process.  (Not to mention that
>> such an approach would be fragile at best.)
>>
>> Suggestions welcome.  Thanks.
>>
>> -- Mike
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list