Using the Stan book with RStudio


Hi, I’m trying to build the documentation/book for use within RStudio, but I’ve hit a snag. I’ve used RStudio before, but RMarkdown is new to me. Anyway, I cloned the git repository, opened the index.Rmd file and clicked the Knit button. It seems to build (almost) everything OK, but at the very end of the process I get this error.

Output created: _book/index.html
Error: attempt to apply non-function
Execution halted

There does appear to be a bunch of new files in the _book/ directory and I can manually open the HTML files in a browser, but there does not seem to be any integration in RStudio. Any help would be appreciated.


If you go to the repo and execute make docs in a shell or in the Terminal emulator of RStudio, it should work if you have the necessary dependencies. It actually calls bookdown::render_book rather than knitr::knit.


Thanks for the quick response! The docs seemed to build without error (after installing doxygen). However, I’m still confused on how to integrate the docs with RStudio. I get the impression that the markdown text should be formatted either in the source window or in the viewer window, but I just see the raw markdown text. Am I mistaken, and I should just expect to read the markdown files as text?

Also, originally I was was building the docs from the stan-book repository, which had Rmd files in it. It doesn’t have a makefile, so I cloned the full Stan repository and built the docs from there. However, in the full Stan repository there are no .Rmd files. The other difference I noticed is building with Knit create a _book directory with the html and md files, where as the Stan repository built everything right in the doc/reference-manual directory. Opening an md file from either place and clicking Preview in RStudio results in the following error.

Error in bookdown::render_book("index.Rmd", "bookdown::gitbook") : 
No input R Markdown files found from the current directory /home/reid/git/stan-book/_book or in the
rmd_files field of _bookdown.yml
Execution halted