Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使代码和输出以增量方式显示在R演示文稿中_R_R Markdown - Fatal编程技术网

使代码和输出以增量方式显示在R演示文稿中

使代码和输出以增量方式显示在R演示文稿中,r,r-markdown,R,R Markdown,我知道这是可能的 是否可以对代码样本和该代码的输出执行相同的操作,无论输出是文本还是绘图 编辑: 当我运行@MartinSchmelzer的代码时,我得到以下错误: pandoc: Could not fetch https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js HttpExceptionRequest Request { host = "ajax.googleapis.com"

我知道这是可能的

是否可以对代码样本和该代码的输出执行相同的操作,无论输出是文本还是绘图

编辑:

当我运行@MartinSchmelzer的代码时,我得到以下错误:

pandoc: Could not fetch https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
HttpExceptionRequest Request {
  host                 = "ajax.googleapis.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/ajax/libs/jquery/3.2.1/jquery.min.js"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (InternalException (HandshakeFailed Error_EOF))
Error: pandoc document conversion failed with error 67
Execution halted
编辑2

这里提出的解决方案不起作用。添加


yaml标题允许编辑文档,但图像不再是编辑的,它似乎是笔记本格式。

如果使用展示演示文稿,您可以执行以下操作:

---
output:
  revealjs::revealjs_presentation:
    incremental: true
---
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $('div.chunk').children().each(function(i) {
    $(this).addClass('fragment');
  });
});
</script>

## Test

- 1
- 2

<div class="chunk">
```{r}
plot(cars)
```
</div>


## Test 2
<div class="chunk">
```{r}
head(mtcars)
```
</div>

R演示还是显示?这看起来很酷,但当我运行它时,我得到一个错误。它很长,所以我在上面加了它。你在办公室电脑上吗?可能是防火墙问题吗?不,我在家里的个人电脑上没有防火墙。加油!!我需要在revealjs下添加
自包含:no
,在测试后做了一些更新。不过现在得睡觉了。还有什么问题我明天再查。
---
output:
  revealjs::revealjs_presentation:
    incremental: true
---
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $('div.chunk').children().each(function(i) {
    $(this).addClass('fragment');
  });
});
</script>

## Test

- 1
- 2

<div class="chunk">
```{r}
plot(cars)
```
</div>


## Test 2
<div class="chunk">
```{r}
head(mtcars)
```
</div>
---
output:
  revealjs::revealjs_presentation:
    incremental: true
    self_contained: true
    includes:
      in_header: js.txt
---