簡體   English   中英

RAPPORT不會在R Markdown中導出表

[英]RAPPORT does not export table in R Markdown

感謝您提供有趣的RAPPORT軟件包。 我想使用RStudio在R Markdown文檔中創建一個融洽的表,但它通過knitr命令而不是為表創建html代碼。 當我在R命令行中一一運行命令時,它可以工作。

這是Markdown代碼塊:

{rt, 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> &quot;## Description&quot; attr(,&quot;class&quot;) [1] &quot;knit_asis&quot; attr(,&quot;knit_cacheable&quot;) [1] TRUE[1] &quot;template will return descriptive statistics of a numerical or frequency table of a categorical variable.&quot; 

這是我逐行執行代碼並獲得正確結果時的輸出:

 <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> 

Julian的這篇文章中找到了答案 :在pander中禁用knitr.auto.asis選項,並在knitr中手動設置result ='asis'。

ASIS的解決方法

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM