[Rd] RFC: allow packages to advertise vignettes on Windows

From: Seth Falcon <sfalcon_at_fhcrc.org>
Date: Mon, 14 May 2007 16:15:31 -0700


The vignette concept, which started in Bioconductor, seems to be catching on. They are supported by R CMD build/check and documented in the Writing R Extensions manual. I think vignettes are a fantastic way to introduce new users to a package. However, getting new users to realize that a vignette is available can be challenging.

For some time now, we have had a function in Biobase that creates a "Vignettes" menu item in the R Windows GUI and gives packages a mechanism to register their vignettes so that they appear on this menu. I would like to see this functionality included in R so that there can be a standard mechanism that doesn't depend on Biobase of registering a package's vignettes with one of the R GUIs (currently only Windows is supported, but I imagine the OS X GUI could also implement this).

Below is the implementation we have been using. Is there an R-core member I can interest in pushing this along? I'm willing to submit a patch with documentation, etc.

+ seth

addVigs2WinMenu <- function(pkgName) {

    if ((.Platform$OS.type == "windows") && (.Platform$GUI == "Rgui")

        && interactive()) {
        vigFile <- system.file("Meta", "vignette.rds", package=pkgName)
        if (!file.exists(vigFile)) {
            warning(sprintf("%s contains no vignette, nothing is added to the menu bar", pkgName))
        } else {
            vigMtrx <- .readRDS(vigFile)
            vigs <- file.path(.find.package(pkgName), "doc", vigMtrx[,"PDF"])
            names(vigs) <- vigMtrx[,"Title"]

            if (!"Vignettes" %in% winMenuNames())
            pkgMenu <- paste("Vignettes", pkgName, sep="/")
            for (i in vigs) {
                item <- sub(".pdf", "", basename(i))
                winMenuAddItem(pkgMenu, item, paste("shell.exec(\"", as.character(i), "\")", sep = ""))
        } ## else
        ans <- TRUE
    } else {
        ans <- FALSE

Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center

R-devel_at_r-project.org mailing list
Received on Mon 14 May 2007 - 23:17:52 GMT

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 18 May 2007 - 15:03:26 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.