Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 733
M.Qasim Avatar asked Sep 01 '14 06:09

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 148
R Yoda Avatar answered Nov 05 '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 43
MGH Avatar answered Nov 05 '22 21:11

MGH