Reputation: 3992
In several packages, most recently the matlib
package on github, https://github.com/friendly/matlib,
I have a README.{md,Rmd} file that says something like
A small collection of vignettes is now available. Use
browseVignettes("matlib")
to see them.
I'd like to replace or add to this in the README with a list of the vignette names and their titles.
The closest I can come to the info I want in the README is the result of > vignette(package= "matlib")
that looks like this:
Vignettes in package ‘matlib’:
eigen-ex1 Eigenvalues and Eigenvectors: Properties
(source, html)
eigen-ex2 Eigenvalues: Spectral Decomposition (source,
html)
det-ex2 Evaluation of determinants (source, html)
ginv Generalized inverse (source, html)
gramreg Gram-Schmidt Orthogonalization and Regression
(source, html)
inv-ex1 Inverse of a matrix (source, html)
inv-ex2 Matrix inversion by elementary row operations
(source, html)
det-ex1 Properties of determinants (source, html)
linear-equations Solving Linear Equations (source, html)
But I want to capture the result of this in a chunk or sth I can use directly in the README. If I build the package site with pkgdown
, I get the resulting links to vignettes under **Articles*, but I still don't have the list of vignette names and titles as anything I can use directly.
Upvotes: 5
Views: 352
Reputation: 3992
For the record, tools::getVignetteInfo()
gives me what I want
> vinfo <- tools::getVignetteInfo("ggplot2")
> vinfo
Package Dir Topic
[1,] "ggplot2" "C:/R/R-3.6.3/library/ggplot2" "ggplot2-specs"
[2,] "ggplot2" "C:/R/R-3.6.3/library/ggplot2" "extending-ggplot2"
[3,] "ggplot2" "C:/R/R-3.6.3/library/ggplot2" "ggplot2-in-packages"
File Title
[1,] "ggplot2-specs.Rmd" "Aesthetic specifications"
[2,] "extending-ggplot2.Rmd" "Extending ggplot2"
[3,] "ggplot2-in-packages.Rmd" "Using ggplot2 in packages"
R PDF
[1,] "ggplot2-specs.R" "ggplot2-specs.html"
[2,] "extending-ggplot2.R" "extending-ggplot2.html"
[3,] "ggplot2-in-packages.R" "ggplot2-in-packages.html"
>
Upvotes: 3