2017-10-19 150 views
0

不添加交叉引用標籤以表我有下述R代碼塊的bookdown文檔中:knitr :: kable在輸出

```{r list-organisms, include = TRUE, echo = FALSE, as.is = TRUE} 
data %>% 
    dplyr::select(biological_source_name) %>% 
    unique() %>% 
    dplyr::rename("Biological Source" = biological_source_name) %>% 
    knitr::kable(caption = "List of source microbial genomes used in the benchmarks.", booktabs = TRUE) 
``` 

在我使用交叉引用諸如文檔:

listed in Table \@ref(tab:list-organisms). 

但是,這些都沒有找到,我得到整個文檔??。生成的html看起來像:

<table> 
<thead> 
<tr class="header"> 
<th align="left">Biological Source</th> 
</tr> 
</thead> 
<tbody> 
<tr class="odd"> 
<td align="left">T. composti</td> 
</tr> 
... 

表標題也沒有出現。

回答

0

我解決了這個問題。在表格中只有一列時,knitr::kable文檔不能正確輸出。在表中添加額外的列生成了圖例並修復了交叉引用。