Newbie---Multiple Outputs, R Errors, TeX

I am a new user of Rmarkdown and the Rstudio IDE on a Mac. I hope the following questions do not seem inane. I have an R file that takes 15 minutes or so to run (reading in lots of data), etc.

  1. Is it possible to obtain multiple outputs from the same R run? I would like to get an html_document, a pdf_document, and a beamer presentation without having to run three times 15 minutes for my R program.

  2. If I get an R error during execution, how do I get to the (global) R session in which the R program was running, so that I can inspect variables, make changes, etc.?

  3. How does the Macos Rstudio determine whether TeX is installed or not? I got an error that it failed to find the TeX installation, but I have /Applications/ and the respective command line utilities all installed.

  4. Instead of a pdf_document, can I ask Rstudio to create the (pdfla-)tex document, so that I can make a few more hand changes before I compile it?

Advice appreciated.

Sincerely, /iaw4

First and fourth questions are answered here -, although I would highly recommend to go through the relevant chapters of the book anyways. There is probably an answer to the third question somewhere in the book as well.

Second question is a little bit more tricky (especially with markdown), but in general you have whole family of functions to help you with this: browser, debugonce, recover. They are designed to help you at least narrow down the problem.

For example, I imagine, there is a particular function (or functions) that you'd want to debug, so you can add browser() into your markdown just before you are about to execute this function and you'll get exactly what you've described - state of R session at this point of time. You can then step through the calls and see what causes the error.


thanks. bought the book and reading it now. regards, /iaw

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.