Generating PDFs with LaTex formatting and R code

I am currently using R Markdown in R Studio for doing academic work. I’d prefer to use Architect for this because of the refactoring (and when I figure out how to integrate it, unit testing). I see there is an external run tool knitr-pdf, but when I try to run it on an RMD file that does work under R Studio, I get the error message:
No resource for ‘source document’ selected in the active Workbench window.
I have no idea what that means, but if I could see an example of a document with LaTex formatting and R code in it, within Architect, and turned into a pdf, then I might be able to figure out how to change my existing RMD file to get it to generate a pdf.

P.S. I don’t know how knitr-pdf (or latex-pdf or sweave) actually work, so if using these things in Architect requires an intimate knowledge of these libraries, I’ll probably have to skip using Architect for this.

Hi @jeff,

Regarding the error message you get, it probably means the file you are trying to compile is not active (open). At the same time, knitr-pdfwas intended for knitr (.Rnw) files, so it wouldn’t work correctly for an .Rmd file: it calls knit function, so you’ll get an .md file. latex-pdf works on .tex files.
For .Rmd files there are multiple options:

  • In “external tools configuration” create a new configuration for “Wikitext+R Document Processing”. There you can “Load Preset/Sample” > “Auto (yaml) single-step” and then run it the same way as knitr-pdf:
  • Create an R code snippet and then run it via right-click on a file, or by assigning a keyboard shortcut to it:
  • Finally, you can always run rmarkdown's render or run from the console…
1 Like