Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print message into R markdown console while knitting

Tags:

r

r-markdown

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?

like image 961
Mikolaj Avatar asked Jun 13 '17 10:06

Mikolaj


2 Answers

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.

like image 126
Mikolaj Avatar answered Nov 14 '22 23:11

Mikolaj


How about ?

    cat(file="readability.txt")
like image 40
AaronP Avatar answered Nov 14 '22 23:11

AaronP