我有一些 Rmarkdown 文档我正在尝试knit/render作为PDF文件。我想要render正常工作,因为我将在具有多个 Rmd 文件以及许多其他进程(例如数据抓取和处理)的脚本中运行它。
使用该knit按钮会产生所需的结果。如果我使用rmarkdown::render表格布局就会变得古怪(参见示例)。这是重现我的问题的最小示例。
RMD
---
title: "RmdTest"
author: "TTS"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output: pdf_document
always_allow_html: true
---
```{r Rmd-Setup, include=FALSE}
options(knitr.kable.NA = '')
library(kableExtra)
# Dummy Data
df <- structure(list(Location = c("Farm", "Farm", "Farm", "Farm"),
Animal = c("dog", "cat", "cat", "cat"), Age = c("Adult",
"Juvenile", "Adult", "Total"), Abundance = c(27269L, 62308L,
34904L, 97212L)), row.names = c(NA, -4L), class = "data.frame") …Run Code Online (Sandbox Code Playgroud) 当我尝试将Rmarkdown文档编译为pdf时,出现以下错误:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
Run Code Online (Sandbox Code Playgroud)
有人知道这意味着什么吗?