M.Qasim
M.Qasim

Reputation: 1878

How to increase stack space overflow for pandoc in R?

I am getting the following error with Knit HTML:

Stack space overflow: current size 16777216 bytes.
Use `+RTS -Ksize -RTS' to increase it.
Error: pandoc document conversion failed with error 2

I am trying to solve the issue by adding the following lines on the top of markdown script:

 ```r
pandoc +RTS -K64m -RTS -f rst -
```

I was just wondering if the code is correct or where shall I place the code to make it work?

Upvotes: 17

Views: 8188

Answers (2)

R Yoda
R Yoda

Reputation: 8770

Solution: Add the following code snippet at the beginning of your Rmd file to increase the stack size:

---
title: "Habits"
output:
  html_document:
    pandoc_args: [
      "+RTS", "-K64m",
      "-RTS"
    ]
---

Upvotes: 25

MGH
MGH

Reputation: 51

Here is a possible workaround. After failing to resolve the error using the RStudio GUI button to 'Knit HTML', the following generated the expected HTML file.

library(knitr)
knit2html('./myNotes.Rmd')

Hope that helps.

Upvotes: 3

Related Questions