0

在几个包中,最近matlib在 github 上的包https://github.com/friendly/matlib我有一个 README.{md,Rmd} 文件,上面写着类似

现在有一小部分小插曲可供使用。用browseVignettes("matlib")来看他们。

我想在 README 中用小插图名称及其标题列表替换或添加此内容。

在 README 中,我最接近我想要的信息的结果> vignette(package= "matlib")如下所示:

 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)

但是我想在一个块中捕获这个结果,或者我可以直接在 README 中使用。如果我使用 构建包站点pkgdown,我会在 **Articles* 下获得指向小插图的链接,但我仍然没有可以直接使用的小插图名称和标题列表。

4

1 回答 1

0

为了记录,tools::getVignetteInfo()给我我想要的

> 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"
> 
于 2020-04-07T14:03:51.700 回答