簡體   English   中英

Papaja/RMarkdown:從代碼塊中加載文件

[英]Papaja/RMarkdown: Loading a file from inside a code chunk

我正在嘗試從 papaja 文檔中的代碼塊內部加載文件

這是我的 header

---
title             : "The title"
shorttitle        : "Title"

author: 
  - name          : "First Author"
    affiliation   : "1"
    corresponding : yes    # Define only one corresponding author
    address       : "Postal address"
    email         : "my@email.com"
    role:         # Contributorship roles (e.g., CRediT, https://casrai.org/credit/)
      - Conceptualization
      - Writing - Original Draft Preparation
      - Writing - Review & Editing
  - name          : "Ernst-August Doelle"
    affiliation   : "1,2"
    role:
      - Writing - Review & Editing

affiliation:
  - id            : "1"
    institution   : "Wilhelm-Wundt-University"
  - id            : "2"
    institution   : 

authornote: 
abstract: 
keywords          : "keywords"
wordcount         : "X"

bibliography      :

floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
header-includes   :    
documentclass     : "apa6"
classoption       : "man"
output            : 
  papaja::apa6_pdf:
    latex_engine: xelatex
---

還有我的代碼塊

``` {r load file}
load("C:/Users/Raphael/Documents/git/masterarbeit/analysis/coding/debugging/issues/missing_viz.Rda")
```

如果我從控制台加載文件,一切正常。 但是,當我嘗試編織文檔時,出現以下錯誤:

File  not found in resource path
Error: pandoc document conversion failed with error 99
Execution halted

如果我這樣做,我會收到相同的錯誤消息

``` {r load file}
load("missing_viz.Rda")
```

(我認為 Rmd 和文件不在同一個文件夾中可能會有問題,如https://community.rstudio.com/t/pandoc-document-conversion-failed-with-error-99/18035 - 但他們是。)。

有人有解釋嗎? Imo即使在同一個文件夾中沒有.Rda in.Rmd,如果我指定完整路徑,該命令應該可以工作。

您沒有在 YAML header 中指定參考書目文件的有效路徑。 這就是 pandoc 找不到文件的原因。 您必須指定.bib文件的相對或絕對文件路徑,或完全刪除 YAML 關鍵bibliography:即,刪除 YAML 標頭中的相應代碼行)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM