R markdown compile error:

2019-07-17 07:01发布

When I try to compile an Rmarkdown document to pdf, I get this error:

    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.

Does anyone know what this means?

2条回答
Lonely孤独者°
2楼-- · 2019-07-17 07:42

You need to choose what format you want to KNIT to, tried to look at mine.

---
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

查看更多
做个烂人
3楼-- · 2019-07-17 07:52

Have you tried the following? (FROM: https://bookdown.org/yihui/bookdown/html-widgets.html)

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

It worked for me. See also: https://github.com/rstudio/bookdown/issues/440

查看更多
登录 后发表回答