简体   繁体   English

如何在自述文件或相关的包中列出小插图

[英]how to list vignettes in a package in a README or related

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在几个包中,最近是 github 上的matlibhttps://github.com/friendly/matlib ,我有一个 README.{md,Rmd} 文件,上面写着类似

A small collection of vignettes is now available.现在可以使用一小部分小插图。 Use browseVignettes("matlib") to see them.使用browseVignettes("matlib")来查看它们。

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:我在自述文件中最接近我想要的信息的是> 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)

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.如果我使用pkgdown构建包站点,我会在 **Articles* 下获得指向小插图的结果链接,但我仍然没有可以直接使用的小插图名称和标题列表。

For the record, tools::getVignetteInfo() gives me what I want为了记录, 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"
> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM