See outputs in R Markdown Console

rmarkdown

#1

Hi,

I am knitting an R Markdown document, and I was wondering if there is any way to get outputs to show up in the R Markdown console (i.e. the extra console that shows up next to the normal console when R Markdown is being knit).

The knitting process is quite long and slow (because of my slow code), and I would find it useful to be able to print some intermediate values to look at while I am waiting :smiley:

Is there some chunk option I can use to print to console? I've seen stuff printed there in the past (I think generally warnings and messages when I set warnings=FALSE or message=FALSE) but I am not sure if there is a direct way to do so.

Thanks!


#2

Hi @AJF,

Have you tried to use the warning() and message() functions from base R? As you said, warnings and messages are printed to the console output if their respective knitr options are set to FALSE (explained here).


#3

Thats what I ended up doing - but it felt a bit kludgy (i.e. I had to make a separate chunk for it, etc...). But it worked!