vignette {utils}R Documentation

View or List Package Vignettes


View a specified package vignette, or list the available ones.


vignette(topic, package = NULL, lib.loc = NULL, all = TRUE)

## S3 method for class 'vignette'
print(x, ...)
## S3 method for class 'vignette'
edit(name, ...)



a character string giving the (base) name of the vignette to view. If omitted, all vignettes from all installed packages are listed.


a character vector with the names of packages to search through, or NULL in which ‘all’ packages (as defined by argument all) are searched.


a character vector of directory names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known.


logical; if TRUE search all available packages in the library trees specified by lib.loc, and if FALSE, search only attached packages.

x, name

Object of class vignette.


Ignored by the print method, passed on to file.edit by the edit method.


Function vignette returns an object of the same class, the print method opens a viewer for it. The program specified by the pdfviewer option is used for viewing PDF versions of vignettes. If several vignettes have PDF/HTML versions with base name identical to topic, the first one found is used.

If no topics are given, all available vignettes are listed. The corresponding information is returned in an object of class "packageIQR".

The edit method copies the R code extracted from the vignette to a temporary file and opens the file in an editor (see edit). This makes it very easy to execute the commands line by line, modify them in any way you want to help you test variants, etc.

See Also

browseVignettes for an HTML-based vignette browser; RShowDoc(<basename>, package = "<pkg>") displays a “rendered” vignette (pdf or html).


## List vignettes from all *attached* packages
vignette(all = FALSE)

## List vignettes from all *installed* packages (can take a long time!):
vignette(all = TRUE)

## Not run: 
## Open the grid intro vignette

## The same
v1 <- vignette("grid")

## Now let us have a closer look at the code

## An alternative way of extracting the code,
## R file is written to current working directory

## A package can have more than one vignette (package grid has several):
vignette(package = "grid")
## The same, but without searching for it:
vignette("rotated", package = "grid")

## End(Not run)

[Package utils version 3.2.2 Index]