Re: [Rd] Creating package Vignette

From: steven mosher <moshersteven_at_gmail.com>
Date: Thu, 14 Jul 2011 12:35:17 -0700

 Also useful if you want to do an FAQ

On Thu, Jul 14, 2011 at 10:12 AM, Melissa Jane Hubisz <mjhubisz_at_gmail.com>wrote:

> Another workaround is to create a "dummy" vignette which does nothing
> but include the pdf file. Something like this:
> vignette.Rnw:
>
> % \VignetteIndexEntry{vignette}
> % \VignetteKeywords{keywords here}
> % \VignettePackage{package name}
>
> \documentclass[a4paper]{article}
> \usepackage{hyperref}
> \usepackage{pdfpages}
> \begin{document}
> \includepdf[fitpaper=true,pages=-]{vignette-source.pdf}
> \end{document}
>
> Not sure if this is totally kosher, but I did this for my package when
> the vignette was too computationally intensive to be submitted to
> CRAN.
> -Melissa
>
> On Thu, Jul 14, 2011 at 1:00 PM, Ben Bolker <bbolker_at_gmail.com> wrote:
> > Prof Brian Ripley <ripley <at> stats.ox.ac.uk> writes:
> >
> >>
> >> It depends what you mean by 'vignette': the R docs have been unclear
> >> (but R >= 2.13.0 are more consistent). In most cases a 'vignette' is
> >> an Sweave document, the vignette source being the .Rnw file, and the
> >> vignette PDF the processed .pdf file.
> >>
> >> At present vignette() means Sweave documents, as only they have
> >> metadata like titles. This is planned to be changed soon.
> >>
> >> On Thu, 14 Jul 2011, Nipesh Bajaj wrote:
> >>
> >> > Hi all, I was trying to create some vignette files for my newly
> >> > developed package, however wondering whether there could be any
> >> > simpler way to do so. In writing R extension it is advised to go
> >> > through Sweave route, however I have already got a big pdf file and
> >> > want to use this as package vignette.
> >> >
> >> > So far I have manually created the inst/doc folder in the main package
> >> > skeleton, and put that file into this, which is not working by calling
> >> > "vignette(file_name)" after I build and load the package. I am
> >>
> >> file_name is not an argument to vignette(): it is 'topic'. And topics
> >> are normally file basenames (without any extension), not file names.
> >>
> >> > getting following error without opening that pdf file: "vignette
> >> > 'file_name' *not* found"
> >> >
> >> > So I like to know, is there any way to use any arbitrary pdf file as
> >> > vignette?
> >>
> >> By definition, no.
> >>
> >> >
> >> > Any suggestion is highly appreciated.
> >
> > One possibility: as a workaround, you could include your
> > own "xvignette" function in your package: see below.
> > It won't show you indices, but it will pick up any appropriately
> > named file that you include in the inst/doc directory of your
> > package ...
> >
> > xvignette <- function(vname,pkg,ext="pdf") {
> > vname <- paste(vname,ext,sep=".")
> > fn <- system.file("doc",vname,package=pkg)
> > if (nchar(fn)==0) stop("file not found")
> > utils:::print.vignette(list(pdf=fn))
> > invisible(fn)
> > }
> >
> > You'll have to somehow alert your package users to the
> > fact that this alternative documentation exists -- perhaps in the help
> > package for the package itself.
> >
> > You might fill in the default value of "pkg" above with your
> > package name to make it easier on the user: I thought about
> > using some version of getPackageName(environment(xvignette))
> > to do it automatically, but that seems too complicated ...
> >
> > ______________________________________________
> > R-devel_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 14 Jul 2011 - 19:38:54 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Jul 2011 - 13:10:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive