我是R的新手,如有任何帮助,我将不胜感激.

我想轮换一页风景在Rmarkdown (Pdf).

在YAML标题中,我添加了以下内容(基于上一篇帖子):

header-includes:
- \usepackage{pdflscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
output: pdf_document

然后:

\blandscape

我希望更改为横向的位置(不应将其添加到代码块中正确吗?).

但是,我收到一条错误消息:

! LaTeX Error: \begin{landscape} on input line 193 ended by \end{document}.

这可能是一个愚蠢的问题,但我需要下载这个程序包pdflscape吗?或者我做错了什么?

谢谢!

推荐答案

您还应该以\elandscape作为您的景观页面的结尾:

---
header-includes:
- \usepackage{pdflscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
output: pdf_document
---

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

## R Markdown

This is an R Markdown document. 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. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

\blandscape

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

\elandscape

输出:

enter image description here

R相关问答推荐

R中的枢轴/转置

使用scale_x_continuous复制ggplot 2中的离散x轴

混淆矩阵,其中每列和等于1

如何使用geom_sf在边界显示两种 colored颜色 ?

查找满足SpatRaster中条件的单元格位置

从gtsummary包中使用tBL_strata()和tBL_summary()时删除变量标签

大规模重新标记haven标签数据

次级y轴R gggplot2

筛选出以特定顺序患病的个体

如何在观测缺失的地方添加零

从服务器在Shiny中一起渲染图标和文本

有没有一种方法可以同时对rhandsontable进行排序和从rhandsontable中删除?

在R中,我如何使用滑动窗口计算位置,然后进行过滤?

在数据帧列表上绘制GGPUP

按列中显示的配对组估算NA值

如何将一些单元格的内容随机 Select 到一个数据框中?

如何对r中包含特定(未知)文本的行求和?

将工作目录子文件夹中的文件批量重命名为顺序

为什么在写入CSV文件时Purrr::Pwalk不起作用

是否有一个R函数可以输出在输入的字符向量中找到的相应正则表达式模式?