当我把它放在R Presentation中的自定义div中时,我遇到了一个能够渲染R代码的问题。所以我设置了一个新的div类,它将数据分成两列,但这些div中的R代码返回markdown文本。
<div class="two-col">
```{r, echo=FALSE}
library(ggplot2)
library(gridExtra)
# Read data
annotation_data = read.csv("Data/chr7_15_qtl_genes.csv")
annotation_summary = read.table("Data/chr7_15_qtl_genes_summary.txt", sep = "\t", header = TRUE)
#Move factors of evidence around for graphing
annotation_data$Evidence = factor(annotation_data$Evidence, levels(annotation_data$Evidence)[c(1,2,5,3,4)])
#Counts of predicted functions from Provean
ggplot(annotation_data, aes(Evidence, group=1)) + geom_bar(stat="count", aes(fill=Evidence)) + labs(y="Count", title="Count of predicted Functions")
grid.table((annotation_summary[1:20,1:2]))
```
</div>
我想知道是否有人之前遇到过此问题并对如何解决此问题有任何想法。感谢
答案 0 :(得分:0)
只是一个解决方法,但我隐藏了输出,只是为创建的图形直接创建了img标签。希望这对某些人有所帮助。
<div class="two-col">
```{r, echo=FALSE, include=FALSE}
library(ggplot2)
library(gridExtra)
# Read data
annotation_data = read.csv("Data/chr7_15_qtl_genes.csv")
#Move factors of evidence around for graphing
annotation_data$Evidence = factor(annotation_data$Evidence, levels(annotation_data$Evidence)[c(1,2,5,3,4)])
#Counts of predicted functions from Provean
ggplot(annotation_data, aes(Evidence, group=1)) + geom_bar(stat="count", aes(fill=Evidence)) + labs(y="Count", title="Count of predicted Functions")
```
<img src="eqtl_presentation-figure/unnamed-chunk-1-1.png">
```{r, echo=FALSE, include=FALSE}
#Show table of annotation summary
annotation_summary = read.table("Data/chr7_15_qtl_genes_summary.txt", sep = "\t", header = TRUE)
grid.table((annotation_summary[1:20,1:2]))
```
<img src="eqtl_presentation-figure/unnamed-chunk-2-1.png">
</div>