How to direct a R markdown output to a different directory using xaringan (problems with the YAML)

24 views Asked by At

Here is my YAML for a Xaringan presentation:

title: "title"
subtitle: "subtitle"
author: 
date: "`r Sys.Date()`"
session: 01
knit: (function(input, encoding) {
      rmarkdown::render(input,
                        output_dir = "C:/.../docs")})
output:
  xaringan::moon_reader:
    css: ["default", "assets/css/aml-theme.css", "assets/css/aml-fonts.css"]
    seal: false
    lib_dir: libs
    nature:
      highlightStyle: solarized-light
      highlightLanguage: R
      highlightLines: true
      countIncrementalSlides: false
      ratio: "16:9"
      beforeInit: "https://platform.twitter.com/widgets.js"
    includes:
      in_header: [assets/header.html]
editor_options: 
  chunk_output_type: console

I can get this to work for pdfs but when I try with xaringan I get this error:

Error in relativeTo(basepath, dir) : 
  The path C:/.../lectures/libs/header-attrs-2.21 does not appear to be a descendant of C:/.../lectures/docs/
Calls: <Anonymous> ... html_dependencies_as_string -> lapply -> FUN -> relativeTo

I assume that this has something to do with where the 'docs' folder is compared to where the 'libs' folder is but I am not sure. The .Rmd file is in my lectures folder and I would like the output to be placed in my '/docs folder.

Thanks in advance for your help.

0

There are 0 answers