更新:我用愚蠢的东西解决了这个问题。我必须在代码块之前包含一个行空间和图,然后它按照我的希望工作。感谢您抽出宝贵时间。
当我“编织”Word或pdf时,我有一个正常工作的降价文档。但是,当我“编织”到html时,没有任何情节出现。堆栈溢出有类似的问题,但我找不到任何重复问题的问题
这是我试图在代码块中使用的指令(它不起作用):
{r, emotional circumplex, fig.align = "center", echo=TRUE}
但是,当我将指令设置为此时,我得到的情节是:
```{r pressure, echo=FALSE}
plot(pressure)
```
问题是,我不想在html文档中生成代码,只是在剧情中。
我尝试了下面列出的“股票”降价示例,但是这些示例也没有出现在html文档中:
---
title: "HTML TEST"
author: "Pete Miksza"
date: "12/12/2017"
output: html_document
---
这是YAML信息:
```{r, emotional circumplex, fig.align = "center", echo=FALSE}
# Emotional Circumplex
ggplot(charlie_brown_dat, aes(x = scale(energy), y = scale(valence))) +
geom_point(aes(size = Tempo, shape = PopularitySplit), color = "darkgreen") +
geom_hline(yintercept = 0, color = "red") +
geom_vline(xintercept = 0, color = "red") +
geom_label_repel(aes(label = track_name), size = 1.7, point.padding = .75) +
scale_x_continuous(limits = c(-2.5, 2.5)) +
scale_y_continuous(limits = c(-2.5, 2.5)) +
labs(title = "Where do the Tracks Sit on an Emotion Circumplex?",
x = "\nValence \n(- negative to + positive)", y = "\nArousal \n(- low energy to + high energy)") +
theme(axis.text.x = element_text(size = 8),
axis.text.y = element_text(size = 8),
axis.title.x = element_text(size = 9, face = "italic"),
axis.title.y = element_text(size = 9, face = "italic"),
axis.line = element_blank(),
axis.ticks = element_blank(),
plot.title = element_text(size = 11, face = "bold"),
legend.title = element_text(size = 8),
legend.key.size = unit(.05, "in"),
legend.text = element_text(size = 6.5),
panel.background = element_rect(fill = "white"),
panel.grid.major = element_line(color = "lightgray"))
```
它不可重复,但这是我实际情节的代码块:
/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS Music_from_a_Charlie_Brown_Christmas.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output Music_from_a_Charlie_Brown_Christmas.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /Users/pmiksza/Library/R/3.4/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/pw/1hpqdrzn5853ys3whns5mg34vh62tx/T//RtmpOt8rhU/rmarkdown-str1dc15577eea.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
我没有收到任何警告消息,但这包含在我的控制台的markdown输出中:
{{1}}
答案 0 :(得分:2)