Now that R 3.0.0+ supports non-Sweave vignettes, R-exts \S 1.4.2 seems to imply that it is possible to include both Sweave and knitr vignettes in a single package. I'm wondering if anyone has tried this and/or if there are some hidden gotchas putting this into practice, and concerned about creating problems with CRAN checks if I try this. Consider two vignettes: pkg/vignettes/vign1.Rnw, containing: % !Rnw weave = Sweave %\VignetteEngine{Sweave} ... pkg/vignettes/vign2.Rnw, containing: % !Rnw weave = knitr %\VignetteEngine{knitr::knitr} ... both are .Rnw files, distinguished only by \VignetteEngine. vign1.Rnw is currently in my package, and vign2.Rnw compiles OK outside it, using knitr in an R console or RStudio. R-exts implies that the DESCRIPTION file must include (minimally): VignetteBuilder: Sweave, knitr Suggests: knitr Is anything more/different required? Does a package exist that does this? TIA -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. & Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele Street Web: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA
On Fri, Aug 23, 2013 at 1:24 PM, Michael Friendly <friendly at yorku.ca> wrote:> Now that R 3.0.0+ supports non-Sweave vignettes, R-exts \S 1.4.2 seems to > imply that > it is possible to include both Sweave and knitr vignettes in a single > package. > > I'm wondering > if anyone has tried this and/or if there are some hidden gotchas putting > this into practice, > and concerned about creating problems with CRAN checks if I try this. >You could easily find out. Add vign2.Rnw to your package, build it, then run R CMD check --as-cran mypkg_.0.0.1.tar.gz Dam> Consider two vignettes: > > pkg/vignettes/vign1.Rnw, containing: > % !Rnw weave = Sweave > %\VignetteEngine{Sweave} > ... > > pkg/vignettes/vign2.Rnw, containing: > % !Rnw weave = knitr > %\VignetteEngine{knitr::knitr} > ... > > both are .Rnw files, distinguished only by \VignetteEngine. vign1.Rnw is > currently in my > package, and vign2.Rnw compiles OK outside it, using knitr in an R console > or RStudio. > > R-exts implies that the DESCRIPTION file must include (minimally): > > VignetteBuilder: Sweave, knitr > Suggests: knitr > > Is anything more/different required? Does a package exist that does this? > > TIA > -Michael > > -- > Michael Friendly Email: friendly AT yorku DOT ca > Professor, Psychology Dept. & Chair, Quantitative Methods > York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 > 4700 Keele Street Web: http://www.datavis.ca > Toronto, ONT M3J 1P3 CANADA > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
On Fri, Aug 23, 2013 at 1:24 PM, Michael Friendly <friendly at yorku.ca> wrote:> Now that R 3.0.0+ supports non-Sweave vignettes, R-exts \S 1.4.2 seems to > imply that > it is possible to include both Sweave and knitr vignettes in a single > package. > > I'm wondering > if anyone has tried this and/or if there are some hidden gotchas putting > this into practice, > and concerned about creating problems with CRAN checks if I try this. > > Consider two vignettes: > > pkg/vignettes/vign1.Rnw, containing: > % !Rnw weave = Sweave > %\VignetteEngine{Sweave} > ... > > pkg/vignettes/vign2.Rnw, containing: > % !Rnw weave = knitr > %\VignetteEngine{knitr::knitr} > ... > > both are .Rnw files, distinguished only by \VignetteEngine. vign1.Rnw is > currently in my > package, and vign2.Rnw compiles OK outside it, using knitr in an R console > or RStudio. > > R-exts implies that the DESCRIPTION file must include (minimally): > > VignetteBuilder: Sweave, knitr > Suggests: knitrThe vignette-builder package for Sweave is 'utils' (not Sweave), so you want: VignetteBuilder: utils, knitr However, as said in 'Writing R Extensions', "The utils package is always implicitly appended to the list of builder packages.", so you don't really need to add it, but personally I'd say it's a nice gesture to make it explicit which vignette-builder package you are using. Also, the full formal engine name for Sweave is utils::Sweave, so for complete parallelism with knitr::knitr, you could be explicit and write \VignetteEngine{utils::Sweave}. /Henrik> > Is anything more/different required? Does a package exist that does this? > > TIA > -Michael > > -- > Michael Friendly Email: friendly AT yorku DOT ca > Professor, Psychology Dept. & Chair, Quantitative Methods > York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 > 4700 Keele Street Web: http://www.datavis.ca > Toronto, ONT M3J 1P3 CANADA > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel