Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stack space overflow error message during `pandoc` conversion (large data?) [duplicate]

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?

like image 506
M.Qasim Avatar asked Nov 23 '22 00:11

M.Qasim


2 Answers

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"
    ]
---
like image 189
R Yoda Avatar answered Nov 30 '22 23:11

R Yoda


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.

like image 22
MGH Avatar answered Nov 30 '22 23:11

MGH