Potentially Useful

Writing boring posts is okay

Viewing R Vignettes

in: Data Science tagged: R

To view a list of vignettes associated with a package (for example, dplyr), enter the following command in any R console:

vignette(package = "dplyr")

You can also use:


To see a specific vignette, use:

vignette("dplyr", package = "dplyr")

You can omit the package option when a vignette is uniquely named, and many packages (by convention) contain an introductory vignette that shares the package’s name. (I.e., vignette("package_name") will often work like you’d expect.)

So what’s a vignette?

Vignettes are long-form guides to packages1 and are installed onto your system along with the rest of the package’s code and documentation. I’ve known this for a while—I even wrote one for my first R package—but I never took the time to learn how to access them locally; instead I’ve always just looked at the list of vignettes on a package’s CRAN page (which is what you need to do if the package isn’t installed already).

Now that I’ve taken a moment to figure out how to use R’s vignette functions, this is already saving me time. But it’s also useful in other circumstances, such as writing code without reliable internet2, when the installed version of a package doesn’t match the latest version on CRAN, or for using packages that haven’t been listed on CRAN.