Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Henrik Bengtsson
On Tue, Jan 21, 2020 at 9:40 AM Gábor Csárdi  wrote:
>
> Yeah, I agree that it would be the best to have something similar in base R.
>
> Short of that, we could have a short piece of code that you could just
> insert into your package, and it would declare the itself as vignette
> builder, which just does the copying.

Yup, but this is probably something you don't want to introduce to
newcomers, because making a package provide it's own vignette engine
comes with problems too, e.g. the package needs to be installed before
it can be built (sic!) so you need to go an extra mile on, say, Travis
CI for this to work.  Because of this, I've avoided documenting and
mentioning this as an option.  I'm also concerned that it will make it
a pain to refine how vignette engines are meant to in base R if there
are 100's of self-contained vignette engines that need to be updated
first.  Vignette engines are still < 100% defined, e.g. only recently
it was discussed what the output directory of vignette engines should
be (it was assumed that everyone wrote to the current directory).

In case people are not aware, I think it's important to clarify that
any additional package dependencies that a vignette engine introduces
is on the burden of the package developer.  They are only required
when you *build* the package (R CMD build).   They are not required
when install or running the package.  In other words, end-users don't
need to worry about those packages.

/Henrik


>
> G.
>
> On Tue, Jan 21, 2020 at 5:30 PM Henrik Bengtsson
>  wrote:
> >
> > The R.rsp::asis and R.rsp::tex could easily be pulled out from R.rsp
> > in a standalone package with zero dependencies.  However, it would be
> > better if they could be brought into the 'tools' package.  This is why
> > I never went down the path or making a standalone package (adding yet
> > another package to CRAN).  These two vignette engines are lightweight,
> > very simple, and does not add dependencies etc.  What stops me is the
> > the amount of work it would take to prepare this proposal.  I worry
> > there might be pushbacks because including a static PDF or static HTML
> > produced in another tool discourage the developer from including the
> > actual source document.  The R.rsp::tex engine is less controversial
> > in this sense; it takes the true LaTeX source and builds a PDF
> > vignette using R's built-in LaTeX tools.  Sure, Sweave can be hijacked
> > for pure LaTeX vignettes, but personally I think that's a hack.  If
> > someone is willing to prepare a proposal, I'm happy to help.  The
> > essential parts for R.rsp::asis are:
> >
> > https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L177-L227
> > https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L367-L372
> >
> > The R.rsp::tex parts need a bit more work to entangle from the rest of the 
> > code.
> >
> > /Henrik
> >
> > On Tue, Jan 21, 2020 at 9:01 AM Gábor Csárdi  wrote:
> > >
> > > Right. Then you _only_ need to install about 5 GBs of software to copy
> > > a PDF file. :/
> > >
> > > I guess if you already have LaTeX and you are sure that it will not
> > > mess up your PDF, then this is another solution.
> > >
> > > Gabor
> > >
> > > On Tue, Jan 21, 2020 at 4:58 PM Ralf Stubner  
> > > wrote:
> > > [...]
> > > > One can use a Sweave vignette and simply include the real PDF with the
> > > > pdfpages package, c.f.
> > > > https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw
> > > >
> > > > cheerio
> > > > ralf

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Gábor Csárdi
Yeah, I agree that it would be the best to have something similar in base R.

Short of that, we could have a short piece of code that you could just
insert into your package, and it would declare the itself as vignette
builder, which just does the copying.

G.

On Tue, Jan 21, 2020 at 5:30 PM Henrik Bengtsson
 wrote:
>
> The R.rsp::asis and R.rsp::tex could easily be pulled out from R.rsp
> in a standalone package with zero dependencies.  However, it would be
> better if they could be brought into the 'tools' package.  This is why
> I never went down the path or making a standalone package (adding yet
> another package to CRAN).  These two vignette engines are lightweight,
> very simple, and does not add dependencies etc.  What stops me is the
> the amount of work it would take to prepare this proposal.  I worry
> there might be pushbacks because including a static PDF or static HTML
> produced in another tool discourage the developer from including the
> actual source document.  The R.rsp::tex engine is less controversial
> in this sense; it takes the true LaTeX source and builds a PDF
> vignette using R's built-in LaTeX tools.  Sure, Sweave can be hijacked
> for pure LaTeX vignettes, but personally I think that's a hack.  If
> someone is willing to prepare a proposal, I'm happy to help.  The
> essential parts for R.rsp::asis are:
>
> https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L177-L227
> https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L367-L372
>
> The R.rsp::tex parts need a bit more work to entangle from the rest of the 
> code.
>
> /Henrik
>
> On Tue, Jan 21, 2020 at 9:01 AM Gábor Csárdi  wrote:
> >
> > Right. Then you _only_ need to install about 5 GBs of software to copy
> > a PDF file. :/
> >
> > I guess if you already have LaTeX and you are sure that it will not
> > mess up your PDF, then this is another solution.
> >
> > Gabor
> >
> > On Tue, Jan 21, 2020 at 4:58 PM Ralf Stubner  wrote:
> > [...]
> > > One can use a Sweave vignette and simply include the real PDF with the
> > > pdfpages package, c.f.
> > > https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw
> > >
> > > cheerio
> > > ralf

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Dirk Eddelbuettel


On 21 January 2020 at 17:58, Ralf Stubner wrote:
| On Tue, Jan 21, 2020 at 5:50 PM Gábor Csárdi  wrote:
| >
| > While R.rsp is a great workaround, I wish we had a better solution for
| > including a static PDF file in a package, one that does not require 6
| > additional packages to leave a file exactly as it is

I second the preference for low-dependency counts.
 
| One can use a Sweave vignette and simply include the real PDF with the
| pdfpages package, c.f.
| https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw

Indeed -- but credit where credit is due. This goes back to a short blog post
by Mark which I referenced here a few times:

 
https://www.markvanderloo.eu/yaRb/2019/01/11/add-a-static-pdf-vignette-to-an-r-package/

The underlying trick is a well-known latex feature that you can slurp pdf
content into pdf output and also described in other places.  But Mark's short
and concise write-up should give everything you need to do this with just
base R and nothing else (by relying on well-honed the Sweave workflow).

Best,  Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Henrik Bengtsson
The R.rsp::asis and R.rsp::tex could easily be pulled out from R.rsp
in a standalone package with zero dependencies.  However, it would be
better if they could be brought into the 'tools' package.  This is why
I never went down the path or making a standalone package (adding yet
another package to CRAN).  These two vignette engines are lightweight,
very simple, and does not add dependencies etc.  What stops me is the
the amount of work it would take to prepare this proposal.  I worry
there might be pushbacks because including a static PDF or static HTML
produced in another tool discourage the developer from including the
actual source document.  The R.rsp::tex engine is less controversial
in this sense; it takes the true LaTeX source and builds a PDF
vignette using R's built-in LaTeX tools.  Sure, Sweave can be hijacked
for pure LaTeX vignettes, but personally I think that's a hack.  If
someone is willing to prepare a proposal, I'm happy to help.  The
essential parts for R.rsp::asis are:

https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L177-L227
https://github.com/HenrikBengtsson/R.rsp/blob/398d75ccc70a33b75c7cdaecef94a24be0dcbad0/R/xweavetangle.R#L367-L372

The R.rsp::tex parts need a bit more work to entangle from the rest of the code.

/Henrik

On Tue, Jan 21, 2020 at 9:01 AM Gábor Csárdi  wrote:
>
> Right. Then you _only_ need to install about 5 GBs of software to copy
> a PDF file. :/
>
> I guess if you already have LaTeX and you are sure that it will not
> mess up your PDF, then this is another solution.
>
> Gabor
>
> On Tue, Jan 21, 2020 at 4:58 PM Ralf Stubner  wrote:
> [...]
> > One can use a Sweave vignette and simply include the real PDF with the
> > pdfpages package, c.f.
> > https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw
> >
> > cheerio
> > ralf

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread neonira Arinoem
Absolutely right Gabor.

Thanks for suggestion Henrik.

I tried to put the PDF directly in /inst/doc but apparently content is
overwritten during vignettes generation, although there exists no name
clash.
Will probably have to try R.rsp!



Le mar. 21 janv. 2020 à 17:32, Gábor Csárdi  a
écrit :

> While R.rsp is a great workaround, I wish we had a better solution for
> including a static PDF file in a package, one that does not require 6
> additional packages to leave a file exactly as it is
>
> Gabor
>
> On Tue, Jan 21, 2020 at 4:30 PM Henrik Bengtsson
>  wrote:
> >
> > It sounds like you want the PDF to have it appear as a package
> > vignette.  You can use the R.rsp::asis vignette engine
> > (https://cran.r-project.org/package=R.rsp) to add static PDFs as
> > vignettes to your package.  The PDF is included as-is during the
> > package *build* process (R CMD build) like other package vignettes and
> > you don't have to LaTeX or other tools installed.  See
> >
> https://cran.r-project.org/web/packages/R.rsp/vignettes/R_packages-Static_PDF_and_HTML_vignettes.pdf
> > for instructions.
> >
> > /Henrik
> > (disclaim: I'm the author)
> >
> > On Tue, Jan 21, 2020 at 7:50 AM neonira Arinoem 
> wrote:
> > >
> > > I create a cheat sheet using MS-OFFICE and  converted it at a PDF
> format.
> > >
> > > I wonder in which folder of my package I should place it to be
> installed
> > > with the package.
> > >
> > > I tried instinctively in vignettes, but it doesn't seem to work
> correctly,
> > > as I do not find it back in my package installation folder.
> > >
> > > Best.
> > > Neonira
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > R-package-devel@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Gábor Csárdi
Right. Then you _only_ need to install about 5 GBs of software to copy
a PDF file. :/

I guess if you already have LaTeX and you are sure that it will not
mess up your PDF, then this is another solution.

Gabor

On Tue, Jan 21, 2020 at 4:58 PM Ralf Stubner  wrote:
[...]
> One can use a Sweave vignette and simply include the real PDF with the
> pdfpages package, c.f.
> https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw
>
> cheerio
> ralf

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Ralf Stubner
On Tue, Jan 21, 2020 at 5:50 PM Gábor Csárdi  wrote:
>
> While R.rsp is a great workaround, I wish we had a better solution for
> including a static PDF file in a package, one that does not require 6
> additional packages to leave a file exactly as it is

One can use a Sweave vignette and simply include the real PDF with the
pdfpages package, c.f.
https://github.com/RcppCore/Rcpp/blob/master/vignettes/Rcpp-introduction.Rnw

cheerio
ralf

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Gábor Csárdi
While R.rsp is a great workaround, I wish we had a better solution for
including a static PDF file in a package, one that does not require 6
additional packages to leave a file exactly as it is

Gabor

On Tue, Jan 21, 2020 at 4:30 PM Henrik Bengtsson
 wrote:
>
> It sounds like you want the PDF to have it appear as a package
> vignette.  You can use the R.rsp::asis vignette engine
> (https://cran.r-project.org/package=R.rsp) to add static PDFs as
> vignettes to your package.  The PDF is included as-is during the
> package *build* process (R CMD build) like other package vignettes and
> you don't have to LaTeX or other tools installed.  See
> https://cran.r-project.org/web/packages/R.rsp/vignettes/R_packages-Static_PDF_and_HTML_vignettes.pdf
> for instructions.
>
> /Henrik
> (disclaim: I'm the author)
>
> On Tue, Jan 21, 2020 at 7:50 AM neonira Arinoem  wrote:
> >
> > I create a cheat sheet using MS-OFFICE and  converted it at a PDF format.
> >
> > I wonder in which folder of my package I should place it to be installed
> > with the package.
> >
> > I tried instinctively in vignettes, but it doesn't seem to work correctly,
> > as I do not find it back in my package installation folder.
> >
> > Best.
> > Neonira
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Henrik Bengtsson
It sounds like you want the PDF to have it appear as a package
vignette.  You can use the R.rsp::asis vignette engine
(https://cran.r-project.org/package=R.rsp) to add static PDFs as
vignettes to your package.  The PDF is included as-is during the
package *build* process (R CMD build) like other package vignettes and
you don't have to LaTeX or other tools installed.  See
https://cran.r-project.org/web/packages/R.rsp/vignettes/R_packages-Static_PDF_and_HTML_vignettes.pdf
for instructions.

/Henrik
(disclaim: I'm the author)

On Tue, Jan 21, 2020 at 7:50 AM neonira Arinoem  wrote:
>
> I create a cheat sheet using MS-OFFICE and  converted it at a PDF format.
>
> I wonder in which folder of my package I should place it to be installed
> with the package.
>
> I tried instinctively in vignettes, but it doesn't seem to work correctly,
> as I do not find it back in my package installation folder.
>
> Best.
> Neonira
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Joris Meys
Dear Neonira,

as Thierry said, the inst folder serves that purpose. To be a bit more 
specific: any documentation you provide that doesn't need building, goes in the 
inst/doc folder. That's also where R CMD build creates the output of vignettes 
created with Sweave or knitr.

You find more information in this section of the manual:
https://cran.r-project.org/doc/manuals/R-exts.html#Writing-package-vignettes

Cheers
Joris

--
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
--

Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



From: R-package-devel  on behalf of 
Thierry Onkelinx 
Sent: Tuesday, January 21, 2020 4:55 PM
To: neonira Arinoem
Cc: R-package-devel
Subject: Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

Dear Neonira.

Whatever file you place in the inst folder, will be available for the users
when they install the package.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkel...@inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///




Op di 21 jan. 2020 om 16:50 schreef neonira Arinoem :

> I create a cheat sheet using MS-OFFICE and  converted it at a PDF format.
>
> I wonder in which folder of my package I should place it to be installed
> with the package.
>
> I tried instinctively in vignettes, but it doesn't seem to work correctly,
> as I do not find it back in my package installation folder.
>
> Best.
> Neonira
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread Thierry Onkelinx
Dear Neonira.

Whatever file you place in the inst folder, will be available for the users
when they install the package.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkel...@inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///




Op di 21 jan. 2020 om 16:50 schreef neonira Arinoem :

> I create a cheat sheet using MS-OFFICE and  converted it at a PDF format.
>
> I wonder in which folder of my package I should place it to be installed
> with the package.
>
> I tried instinctively in vignettes, but it doesn't seem to work correctly,
> as I do not find it back in my package installation folder.
>
> Best.
> Neonira
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] How to provide a finalized PDF file in a package?

2020-01-21 Thread neonira Arinoem
I create a cheat sheet using MS-OFFICE and  converted it at a PDF format.

I wonder in which folder of my package I should place it to be installed
with the package.

I tried instinctively in vignettes, but it doesn't seem to work correctly,
as I do not find it back in my package installation folder.

Best.
Neonira

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel