【问题标题】:RAPPORT does not export table in R MarkdownRAPPORT 不会在 R Markdown 中导出表格
【发布时间】:2015-05-25 04:04:59
【问题描述】:

感谢您提供有趣的 RAPPORT 软件包。我想使用 RStudio 在 R Markdown 文档中创建一个关系表,但它传递了 knitr 命令,而不是为表创建 html 代码。当我在 R 命令行中一一运行命令时,它可以工作。

这是 Markdown 代码块:

{r t, cache=FALSE } rpt = rapport.html('Descriptives.tpl', data=chrt.patients, var="RACE",file.name="Race",file.path="c://hdds//work//california//R Analysis/tmp")

这是我使用 knitrHtml 按钮编译 R Markdown 时的输出:

<p> "## Description" attr(,"class") [1] "knit_asis" attr(,"knit_cacheable") [1] TRUE[1] "template will return descriptive statistics of a numerical or frequency table of a categorical variable."

这是我逐行执行代码并得到正确结果时的输出:

<h2 id="description">Description</h2>
<p>This template will return descri\ptive statistics of a numerical or frequency table of a categorical variable.</p>
<h3 id="race"><em>RACE</em></h3>

【问题讨论】:

  • 我认为这个问题已经被pander 的最新版本(0.5.2)解决了。你能分享你的sessionInfo()吗?另外,您能否分享一下为什么在knitr 中使用rapport 的用例?我对此很感兴趣。谢谢,Gergely

标签: r markdown


【解决方案1】:

我发现 Julian 的 the answer int this post: 在 pander 中禁用 knitr.auto.asis 选项并在 knitr 中手动设置 results='asis'。

使用 asis 的解决方法

{r results='asis'} panderOptions('knitr.auto.asis', FALSE) pander(list(a=c(1,2,3),b=c('A','b') ) )

【讨论】:

    猜你喜欢
    • 2019-08-27
    • 2021-07-15
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-19
    • 2019-03-11
    • 1970-01-01
    相关资源
    最近更新 更多