【问题标题】:Slides are not separating and shown in same page like a document in R markdown幻灯片没有像 R markdown 中的文档那样分开并显示在同一页面中
【发布时间】:2017-12-25 09:23:17
【问题描述】:

我正在尝试学习 R markdown。 所以,我打开了默认的 R markdown 幻灯片演示文档。然后我将部分更改为Slide with R Output。当我编织我创建的代码时,幻灯片没有分开,而是显示为单个document。当我删除代码时,幻灯片会按照我想要的方式分开。

代码如下:

带 R 输出的幻灯片

```{r Moisture}
library(highcharter)
library(tidyverse)

Moisture_kurokawa <- read_csv("raw.csv") %>%
  na.omit() %>%
  mutate(timestamp = lubridate::mdy_hms(sprintf("%s %s", Date, Time)))

hc <- highchart(type="stock")
for (k in names(Moisture_kurokawa)[3:7]) {
  hc <- hc_add_series_times_values(hc=hc, dates=Moisture_kurokawa$timestamp, 
                               values=pull(Moisture_kurokawa, k), name = k)
}
hc%>%hc_legend(enabled=TRUE)

```

我正在使用滑动演示。

非常感谢。

【问题讨论】:

  • 您没有添加任何分页符。我建议不要打开空白文件,而是从模板打开并使用其中一个幻灯片示例。您是否认为将每个模型放在单独的页面上?那会更高级一些。
  • @Elin 添加## 不会自动制作新幻灯片吗?如果没有,我该如何添加分页符。谢谢。
  • 你在使用 RStudio 吗?
  • @ScipioneSarlo 是的。 imgur.com/a/3Yggs。当我删除我的代码时,它再次变成幻灯片演示。
  • 这里:rmarkdown.rstudio.com/lesson-11.html 您可以找到如何根据使用的格式设置幻灯片演示。

标签: r r-markdown


【解决方案1】:

我测试了,现在似乎可以正常工作了(显然你必须设置数据的路径):

---
title: "Untitled"
output: 
    ioslides_presentation:
        fig_width: 7
        fig_height: 6
        fig_caption: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Output {.flexbox .vcenter}

```{r message=FALSE}
library(highcharter)
library(tidyverse)
library(lubridate)

Moisture_kurokawa <- read_csv("./raw.csv") %>%
  na.omit() %>%
  mutate(timestamp = mdy_hms(sprintf("%s %s", Date, Time)))

hc <- highchart(type="stock")
for (k in names(Moisture_kurokawa)[3:7]) {
  hc <- hc_add_series_times_values(hc=hc, dates=Moisture_kurokawa$timestamp, 
                               values=pull(Moisture_kurokawa, k), name = k)
}
hc %>% 
    hc_legend(enabled=TRUE)

```

【讨论】:

  • 我没有看到你在块选项中设置了echo=F
  • 谢谢。我能够在 ios_slides 中创建不同的幻灯片,但仍然无法在 Slidy_presentation 中创建相同的结果。感谢您的宝贵时间
猜你喜欢
  • 2021-12-14
  • 2017-01-12
  • 2021-07-14
  • 1970-01-01
  • 1970-01-01
  • 2015-04-01
  • 1970-01-01
  • 2020-09-21
  • 1970-01-01
相关资源
最近更新 更多