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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Michael Hannon-2
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Ista Zahn
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
<[hidden email]> 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
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Duncan Murdoch-2
In reply to this post by Michael Hannon-2
On 18/02/2018 9:06 PM, Michael Hannon 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.)

You don't say what format the source is, but if it is LaTeX, you just
need to add some comments at the beginning, rename ending in .Rnw, and R
will recognize plain LaTeX files as Sweave vignettes.

See the Writing R Extensions manual, section 1.4.

Duncan Murdoch

>
> Suggestions welcome.  Thanks.
>
> -- Mike
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Michael Hannon-2
In reply to this post by Ista Zahn
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 <[hidden email]> 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
> <[hidden email]> 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
>>
>> ______________________________________________
>> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Michael Hannon-2
In reply to this post by Duncan Murdoch-2
Thanks, Duncan.  The files in question are Emacs Org-mode files, and I
think these are more or less isomorphic to Rmd files, but I haven't
used Org-mode in a long time, so I think the mapping (Org-mode ==>
Rmd) would be painful.

-- Mike


On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch
<[hidden email]> wrote:

> On 18/02/2018 9:06 PM, Michael Hannon 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.)
>
>
> You don't say what format the source is, but if it is LaTeX, you just need
> to add some comments at the beginning, rename ending in .Rnw, and R will
> recognize plain LaTeX files as Sweave vignettes.
>
> See the Writing R Extensions manual, section 1.4.
>
> Duncan Murdoch
>
>>
>> Suggestions welcome.  Thanks.
>>
>> -- Mike
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Duncan Murdoch-2
On 19/02/2018 5:47 AM, Michael Hannon wrote:
> Thanks, Duncan.  The files in question are Emacs Org-mode files, and I
> think these are more or less isomorphic to Rmd files, but I haven't
> used Org-mode in a long time, so I think the mapping (Org-mode ==>
> Rmd) would be painful.

If they aren't LaTeX then they won't be able to masquerade as Sweave
files, so things are more complicated.

I think there are two possibilities.  The better but harder one is to
write your own "vignette engine".  Section 1.4.2 of the manual describes
the process, and ?tools::vignetteEngine describes what is needed in your
engine.

The other possibility is to manually edit an inst/doc/index.html file to
include links to your documents.  They won't be treated as vignettes,
but at least users will be able to find them.  The other disadvantage of
this approach is that you'll need to edit it for all vignettes, not just
the strange ones.

Duncan Murdoch


> -- Mike
>
>
> On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch
> <[hidden email]> wrote:
>> On 18/02/2018 9:06 PM, Michael Hannon 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.)
>>
>>
>> You don't say what format the source is, but if it is LaTeX, you just need
>> to add some comments at the beginning, rename ending in .Rnw, and R will
>> recognize plain LaTeX files as Sweave vignettes.
>>
>> See the Writing R Extensions manual, section 1.4.
>>
>> Duncan Murdoch
>>
>>>
>>> Suggestions welcome.  Thanks.
>>>
>>> -- Mike
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>>
>>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Rainer Krug-2


> On 19 Feb 2018, at 12:25, Duncan Murdoch <[hidden email] <mailto:[hidden email]>> wrote:
>
> On 19/02/2018 5:47 AM, Michael Hannon wrote:
>> Thanks, Duncan.  The files in question are Emacs Org-mode files, and I
>> think these are more or less isomorphic to Rmd files, but I haven't
>> used Org-mode in a long time, so I think the mapping (Org-mode ==>
>> Rmd) would be painful.

That should be easy - you can export org-mode files directly to LaTex. I haven’t used org-mode for some time, but I think it is Ctrl - C - E and than follow the prompts (obviously in emacs).

Rainer


>
> If they aren't LaTeX then they won't be able to masquerade as Sweave files, so things are more complicated.
>
> I think there are two possibilities.  The better but harder one is to write your own "vignette engine".  Section 1.4.2 of the manual describes the process, and ?tools::vignetteEngine describes what is needed in your engine.
>
> The other possibility is to manually edit an inst/doc/index.html file to include links to your documents.  They won't be treated as vignettes, but at least users will be able to find them.  The other disadvantage of this approach is that you'll need to edit it for all vignettes, not just the strange ones.
>
> Duncan Murdoch
>
>
>> -- Mike
>> On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>> On 18/02/2018 9:06 PM, Michael Hannon 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 <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.)
>>>
>>>
>>> You don't say what format the source is, but if it is LaTeX, you just need
>>> to add some comments at the beginning, rename ending in .Rnw, and R will
>>> recognize plain LaTeX files as Sweave vignettes.
>>>
>>> See the Writing R Extensions manual, section 1.4.
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> Suggestions welcome.  Thanks.
>>>>
>>>> -- Mike
>>>>
>>>> ______________________________________________
>>>> [hidden email] <mailto:[hidden email]> mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help <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.
>>>>
>>>
>
> ______________________________________________
> [hidden email] <mailto:[hidden email]> mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help <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.

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

University of Zürich

Cell:       +41 (0)78 630 66 57
email:      [hidden email] <mailto:[hidden email]>
Skype:      RMkrug

PGP: 0x0F52F982




        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

ssefick
Yes, 'C-c C-e l l' I think, but follow the pop-up, and everything should be
ok.

On Feb 19, 2018 07:05, "Rainer Krug" <[hidden email]> wrote:

>
>
> > On 19 Feb 2018, at 12:25, Duncan Murdoch <[hidden email]
> <mailto:[hidden email]>> wrote:
> >
> > On 19/02/2018 5:47 AM, Michael Hannon wrote:
> >> Thanks, Duncan.  The files in question are Emacs Org-mode files, and I
> >> think these are more or less isomorphic to Rmd files, but I haven't
> >> used Org-mode in a long time, so I think the mapping (Org-mode ==>
> >> Rmd) would be painful.
>
> That should be easy - you can export org-mode files directly to LaTex. I
> haven’t used org-mode for some time, but I think it is Ctrl - C - E and
> than follow the prompts (obviously in emacs).
>
> Rainer
>
>
> >
> > If they aren't LaTeX then they won't be able to masquerade as Sweave
> files, so things are more complicated.
> >
> > I think there are two possibilities.  The better but harder one is to
> write your own "vignette engine".  Section 1.4.2 of the manual describes
> the process, and ?tools::vignetteEngine describes what is needed in your
> engine.
> >
> > The other possibility is to manually edit an inst/doc/index.html file to
> include links to your documents.  They won't be treated as vignettes, but
> at least users will be able to find them.  The other disadvantage of this
> approach is that you'll need to edit it for all vignettes, not just the
> strange ones.
> >
> > Duncan Murdoch
> >
> >
> >> -- Mike
> >> On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch
> >> <[hidden email] <mailto:[hidden email]>> wrote:
> >>> On 18/02/2018 9:06 PM, Michael Hannon 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 <
> 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.)
> >>>
> >>>
> >>> You don't say what format the source is, but if it is LaTeX, you just
> need
> >>> to add some comments at the beginning, rename ending in .Rnw, and R
> will
> >>> recognize plain LaTeX files as Sweave vignettes.
> >>>
> >>> See the Writing R Extensions manual, section 1.4.
> >>>
> >>> Duncan Murdoch
> >>>
> >>>>
> >>>> Suggestions welcome.  Thanks.
> >>>>
> >>>> -- Mike
> >>>>
> >>>> ______________________________________________
> >>>> [hidden email] <mailto:[hidden email]> mailing list --
> To UNSUBSCRIBE and more, see
> >>>> https://stat.ethz.ch/mailman/listinfo/r-help <
> 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.
> >>>>
> >>>
> >
> > ______________________________________________
> > [hidden email] <mailto:[hidden email]> mailing list -- To
> UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help <
> 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.
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> University of Zürich
>
> Cell:       +41 (0)78 630 66 57
> email:      [hidden email] <mailto:[hidden email]>
> Skype:      RMkrug
>
> PGP: 0x0F52F982
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Include pre-existing PDF files as vignettes in an R package?

Michael Hannon-2
Exporting to LaTeX is a good idea.  Thanks, guys.


On Mon, Feb 19, 2018 at 4:22 AM, stephen sefick <[hidden email]> wrote:

> Yes, 'C-c C-e l l' I think, but follow the pop-up, and everything should be
> ok.
>
> On Feb 19, 2018 07:05, "Rainer Krug" <[hidden email]> wrote:
>
>>
>>
>> > On 19 Feb 2018, at 12:25, Duncan Murdoch <[hidden email]
>> <mailto:[hidden email]>> wrote:
>> >
>> > On 19/02/2018 5:47 AM, Michael Hannon wrote:
>> >> Thanks, Duncan.  The files in question are Emacs Org-mode files, and I
>> >> think these are more or less isomorphic to Rmd files, but I haven't
>> >> used Org-mode in a long time, so I think the mapping (Org-mode ==>
>> >> Rmd) would be painful.
>>
>> That should be easy - you can export org-mode files directly to LaTex. I
>> haven’t used org-mode for some time, but I think it is Ctrl - C - E and
>> than follow the prompts (obviously in emacs).
>>
>> Rainer
>>
>>
>> >
>> > If they aren't LaTeX then they won't be able to masquerade as Sweave
>> files, so things are more complicated.
>> >
>> > I think there are two possibilities.  The better but harder one is to
>> write your own "vignette engine".  Section 1.4.2 of the manual describes
>> the process, and ?tools::vignetteEngine describes what is needed in your
>> engine.
>> >
>> > The other possibility is to manually edit an inst/doc/index.html file to
>> include links to your documents.  They won't be treated as vignettes, but
>> at least users will be able to find them.  The other disadvantage of this
>> approach is that you'll need to edit it for all vignettes, not just the
>> strange ones.
>> >
>> > Duncan Murdoch
>> >
>> >
>> >> -- Mike
>> >> On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch
>> >> <[hidden email] <mailto:[hidden email]>> wrote:
>> >>> On 18/02/2018 9:06 PM, Michael Hannon 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 <
>> 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.)
>> >>>
>> >>>
>> >>> You don't say what format the source is, but if it is LaTeX, you just
>> need
>> >>> to add some comments at the beginning, rename ending in .Rnw, and R
>> will
>> >>> recognize plain LaTeX files as Sweave vignettes.
>> >>>
>> >>> See the Writing R Extensions manual, section 1.4.
>> >>>
>> >>> Duncan Murdoch
>> >>>
>> >>>>
>> >>>> Suggestions welcome.  Thanks.
>> >>>>
>> >>>> -- Mike
>> >>>>
>> >>>> ______________________________________________
>> >>>> [hidden email] <mailto:[hidden email]> mailing list --
>> To UNSUBSCRIBE and more, see
>> >>>> https://stat.ethz.ch/mailman/listinfo/r-help <
>> 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.
>> >>>>
>> >>>
>> >
>> > ______________________________________________
>> > [hidden email] <mailto:[hidden email]> mailing list -- To
>> UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help <
>> 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.
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> University of Zürich
>>
>> Cell:       +41 (0)78 630 66 57
>> email:      [hidden email] <mailto:[hidden email]>
>> Skype:      RMkrug
>>
>> PGP: 0x0F52F982
>>
>>
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.