R markdown编译错误:

问题描述 投票:3回答:3

[当我尝试将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.

有人知道这意味着什么吗?

r rstudio knitr r-markdown
3个回答
6
投票

您是否尝试过以下内容? (从:https://bookdown.org/yihui/bookdown/html-widgets.html

install.packages("webshot")
webshot::install_phantomjs()

它为我工作。另请参阅:https://github.com/rstudio/bookdown/issues/440


0
投票

[您需要选择要KNIT转换为哪种格式,请尝试查看我的格式。

---
title: "<img src='www/binary-logo.jpg' width='240'>"
subtitle: "[<span style='color:blue'>binary.com</span>](https://github.com/englianhu/binary.com-interview-question) Interview Question I"
author: "[<span style='color:blue'>®γσ, Lian Hu</span>](https://englianhu.github.io/) <img src='www/ENG.jpg' width='24'> <img src='www/RYO.jpg' width='24'>白戸則道®"
date: "`r Sys.Date()`"
output:
  tufte::tufte_html:
    toc: yes
  tufte::tufte_handout:
    citation_package: natbib
    latex_engine: xelatex
  tufte::tufte_book:
    citation_package: natbib
    latex_engine: xelatex
link-citations: yes
---

KNIT


0
投票

我在使用Bookdown时遇到了这个问题,并且在我的上下文中无法接受该解决方案。在弄清楚“ RMarkdown文件的YAML前端”是什么之后,我解决了它。使用bookdown时,有一个.travis.yml文件和一个_bookdown.yml文件,但是您想不理这两个,而这些不是错误消息所引用的内容。

“最重要的内容”将是RMarkdown文件的顶部(如果使用bookdown,则将是“ index.Rmd”文件),请参见以下屏幕截图:enter image description here

因此只需将其作为一行添加到YAML标头中,它就可以按预期工作(或为您提供其他错误)

© www.soinside.com 2019 - 2024. All rights reserved.