2016-03-02 84 views
0

我在R演示文稿中将自定义div放入R代码时出现问题。所以我设置了一个新的div类,它将数据分成两列,但这些div中的R代码返回标记文本。R中呈现R代码的错误自定义div之间的呈现

<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

只是一个解决办法,但我隐藏输出,并直接为创建的图形创建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>