幻灯片不会像R markdown中的文档那样分离并显示在同一页面中

时间:2017-12-25 09:23:17

标签: r r-markdown

我正在努力学习R降价。 所以,我打开了默认的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)

```

我正在使用滑动的演示文稿。

非常感谢。

1 个答案:

答案 0 :(得分: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)

```