在roxygen2 R包文档中插入markdown表

nee*_*elp 6 markdown r roxygen2

我正在写一个R包,我想在R帮助文件中包含一个表,例如在该@details部分中.我尝试直接包含markdown代码:

#' | Tables        | Are           | Cool  |
#' | ------------- |:-------------:| -----:|
#' | col 3 is      | right-aligned | $1600 |
#' | col 2 is      | centered      |   $12 |
Run Code Online (Sandbox Code Playgroud)

但这并没有给我想要的输出.我已经为整个软件包启用了markdown支持并安装了roxygen2 6.0.1.降价表是否不支持?我必须使用\tabular{}吗?

Hug*_*ugh 4

您需要将@md标签添加到您的 roxygen 块中

#' @details
#' The table is: 
#'
#' | Tables        | Are           | Cool  |
#' | ------------- |:-------------:| -----:|
#' | col 3 is      | right-aligned | $1600 |
#' | col 2 is      | centered      |   $12 |
#' 
#' @md
Run Code Online (Sandbox Code Playgroud)

或添加Roxygen: list(markdown = TRUE)到您的DESCRIPTION文件中。