我正在尝试创建一个HTML5演示文稿,其中包含了ggplot2图。我正在使用Rstudio的Rpres格式。但是,我在输出演示文稿中没有看到任何情节。对于下面的示例,我得到一个文本框,其中包含如下消息:
<img src="PT terms for each age
Strata.Rnw-figure/unnamed-chunk-1-1.png" title="plot of chunk
unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display:
block; margin: auto;" />至于其他块,我看不出有什么阴谋。我看到子目录中生成的数字,但它们不包括在演示文稿中。这可能是因为我使用setwd更改其中一个块中的当前目录。
如何确保将情节添加到演示文稿中?
```{r, echo=FALSE,fig.width=8, fig.height=4, warning=FALSE, eval=TRUE, message=FALSE, tidy=TRUE, fig.align='center',fig=TRUE}PT.term.table.combo.df <- structure(list(term = structure(c(3L, 6L, 10L, 9L, 5L, 8L, 2L, 7L, 1L, 4L, 11L, 16L, 20L, 13L, 18L, 19L, 15L, 14L, 17L, 12L), .Label = c("Erythema", "Injection site erythema", "Injection site pain", "Injection site swelling", "Pain", "Pain in extremity", "Paraesthesia", "Pruritus", "Rash", "Urticaria", "Dizziness", "Fatigue", "Headache", "Unknown", "Loss of consciousness", "Nausea", "Pallor", "Pyrexia", "Syncope", "Vomiting", "Blood pressure decreased", "Condition aggravated", "Convulsion", "Fall", "Grand mal convulsion", "Head injury", "Immediate post-injection reaction", "Condition8", "Condition2", "Condition3", "Condition4", "Condition1", "Menstruation delayed", "Menstruation irregular", "Condition5", "Condition12", "Unevaluable event"), class = "factor"), normalized.count = structure(c(0.758666519304954, 0.509556068608868, 0.498746392459638, 0.426484861272957, 0.41955098519173, 0.333070361160926, 0.306233446655841, 0.303395720748491, 0.281332387076534, 0.275858307359097, 2.05157281092953, 1.55514068644281, 0.761792303294041, 0.730331039886107, 0.553772087835693, 0.545722098808532, 0.426814370578148, 0.422207780194755, 0.401335815218956, 0.325021057176447), .Names = c("Injection site pain", "Pain in extremity", "Urticaria", "Rash", "Pain", "Pruritus", "Injection site erythema", "Paraesthesia", "Erythema", "Injection site swelling", "Dizziness", "Nausea", "Vomiting", "Headache", "Pyrexia", "Syncope", "Loss of consciousness", "Hyperhidrosis", "Pallor", "Fatigue")), source = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1", "2", "3", "4"), class = "factor")), .Names = c("term", "normalized.count", "source"), row.names = c("Injection site pain", "Pain in extremity", "Urticaria", "Rash", "Pain", "Pruritus", "Injection site erythema", "Paraesthesia", "Erythema", "Injection site swelling", "Dizziness", "Nausea", "Vomiting", "Headache", "Pyrexia", "Syncope", "Loss of consciousness", "Hyperhidrosis", "Pallor", "Fatigue"), class = "data.frame")library(ggplot2)library(gdata)#PT.term.table.combo.df <- combine(lapply( PT.term.tables$communities , FUN = function(x) { data.frame (term = names(x), normalized.count = x)}),names = 1:4) PT.term.table.combo.df <- do.call(what=combine,args=lapply( PT.term.tables$communities , FUN = function(x) { data.frame (term = names(x), normalized.count = x)}))levels(PT.term.table.combo.df$source)<- 1:4#PT.term.table <- PT.term.tables$communities[[1]]#term.df <- data.frame (term=names(PT.term.table), normalized.count = PT.term.table)PT.plot<-ggplot(data=PT.term.table.combo.df, aes(x=term, y=normalized.count )) + geom_bar(stat='identity') + coord_flip()+facet_wrap(~source)print(PT.plot)发布于 2015-01-02 23:43:58
好的,我可以通过重命名Rpres文件来解决我的问题,这样它就没有任何空格了。因此,我没有选择"PT terms for each age Strata.Rnw.Rpres",而是选择了"PT_terms_plots.Rpres"作为文件名。如果您认为这可能是一个bug,评论让我知道,以便我可以联系Rstudio。
https://stackoverflow.com/questions/27727159
复制相似问题