Mikolaj
Mikolaj

Reputation: 1495

Print message into R markdown console while knitting

I'm wondering if there is a way to print a message containing one of the variables into Rmarkdown console at the end of knitting?

I'm currently preparing an R Markdown template for others to use. I would like to inform the users about the readability index of the document once it finishes compiling. I have already found a way to calculate it in one of the chunks. Now I would like to automatically print it to the person who compiles it in a way that it is not shown in the final document. Any ideas?

Upvotes: 7

Views: 3921

Answers (2)

AaronP
AaronP

Reputation: 185

How about ?

    cat(file="readability.txt")

Upvotes: 3

Mikolaj
Mikolaj

Reputation: 1495

Ben Bolkers comment is the perfect answer. I ended up putting:

{r cache = FALSE, echo = F, warning = F, message = F}
message(rdblty)

at the very bottom of the markdown file. rdblty is the variable calculated before that I wanted to print out.

Upvotes: 8

Related Questions