为什么 R markdown 无法格式化我的拼图?
Why is R markdown not able to format my patchwork figure?
我有一个关于 markdown 和 patchwork 的问题。假设我将数字 FigureLength 和 FigureWidth 组合在一起,通过拼凑而成 CombinedFigure(两个数字彼此重叠):
library(datasets)
library(patchwork)
data(iris)
FigureLength <- iris %>%
ggplot(aes(x = Species, y = Sepal.Length)) +
geom_boxplot()
FigureWidth <- iris %>%
ggplot(aes(x = Species, y = Sepal.Width)) +
geom_boxplot()
CombinedFigure <- FigureLength / FigureWidth
Both figures nicely on top of each other in R
save(CombinedFigure, file = here::here ("CombinedFigure"))
在 Markdown 中,当我将以下内容放入我的 word 文档中时,只有萼片长度出现,而不是两个数字相互重叠。
```{r CombinedFigure, dpi = 300, echo = FALSE}
CombinedFigure
```
What appears in markdown - only one figure
感谢您的帮助。
当我运行以下代码时:
---
title: "Untitled"
author: "Author"
date: "4/4/2022"
output: word_document
---
```{r}
library(datasets)
library(tidyverse)
library(patchwork)
data(iris)
FigureLength <- iris %>%
ggplot(aes(x = Species, y = Sepal.Length)) +
geom_boxplot()
FigureWidth <- iris %>%
ggplot(aes(x = Species, y = Sepal.Width)) +
geom_boxplot()
CombinedFigure <- FigureLength / FigureWidth
```
```{r CombinedFigure, dpi = 300, echo = FALSE}
CombinedFigure
```
我要在 WORD 中将两个数字很好地重叠在一起,如下所示:
我有一个关于 markdown 和 patchwork 的问题。假设我将数字 FigureLength 和 FigureWidth 组合在一起,通过拼凑而成 CombinedFigure(两个数字彼此重叠):
library(datasets)
library(patchwork)
data(iris)
FigureLength <- iris %>%
ggplot(aes(x = Species, y = Sepal.Length)) +
geom_boxplot()
FigureWidth <- iris %>%
ggplot(aes(x = Species, y = Sepal.Width)) +
geom_boxplot()
CombinedFigure <- FigureLength / FigureWidth
Both figures nicely on top of each other in R
save(CombinedFigure, file = here::here ("CombinedFigure"))
在 Markdown 中,当我将以下内容放入我的 word 文档中时,只有萼片长度出现,而不是两个数字相互重叠。
```{r CombinedFigure, dpi = 300, echo = FALSE}
CombinedFigure
```
What appears in markdown - only one figure
感谢您的帮助。
当我运行以下代码时:
---
title: "Untitled"
author: "Author"
date: "4/4/2022"
output: word_document
---
```{r}
library(datasets)
library(tidyverse)
library(patchwork)
data(iris)
FigureLength <- iris %>%
ggplot(aes(x = Species, y = Sepal.Length)) +
geom_boxplot()
FigureWidth <- iris %>%
ggplot(aes(x = Species, y = Sepal.Width)) +
geom_boxplot()
CombinedFigure <- FigureLength / FigureWidth
```
```{r CombinedFigure, dpi = 300, echo = FALSE}
CombinedFigure
```
我要在 WORD 中将两个数字很好地重叠在一起,如下所示: