2014-07-24 73 views
5

下面是可重複使用的示例。只要我包含一個ggvis的數字,我就失去了格式化。在RMarkdown文檔中添加ggvis圖使得knitr :: kable輸出渲染不正確

--- 
title: "test" 
output: html_document 
--- 

```{r setup, include=FALSE} 
library(dplyr) 
library(ggvis) 
library(knitr) 
``` 

The following table looks fine... 

```{r echo=FALSE, results='asis'} 
cars %>% kable(format = 'markdown') 
``` 

As long as I don't include this plot below 

```{r, echo=FALSE} 
pressure %>% 
    ggvis(x = ~temperature, y = ~pressure) %>% 
    layer_bars() 
``` 
+0

對於它的價值,我可以通過將'kable'調用改爲'kable(format =「html」,table.attr ='class = \「table table = striped table-hover \「')' – kevinykuo

回答

2

這可能與在ggvis的開發版本中已修復的錯誤有關。如果你安裝了最新的devtools::install_github('rstudio/ggvis'),它應該可以工作。