Search code examples
rr-markdownsink

Sink is full when calling rmarkdown::render


I'm following this short tutorial to print my R script directly as an HTML document. It should be pretty straightforward. With a few small changes to the header and comments of an otherwise normal R script, calling the command rmarkdown::render('/Users/you/Documents/yourscript.R') at the end of an R script should call the knitr::spin function to go from my R script to an Rmd file to the final HTML or PDF.

I'm getting the error: Error in sink(con, split = debug) : sink stack is full and I'm not sure what to do. All solutions I've found online point out that one needs to close sink()'s after opening them. But since I'm not really using sink() myself, I don't see how or where I should close them.

I'm using R 3.3.0.

This Question asks the same but is downvoted and has no answers.


Solution

  • Well, it turned out I was doing something stupid: I included the command rmarkdown::render('/Users/you/Documents/yourscript.R') within my script and forgot to comment it out. I probably ended doing an infinite recursion. I commented that line out and it worked beautifully.