notgoodatcoding
notgoodatcoding

Reputation: 11

how to hide code messages when knitting r markdown

I'm trying to knit my r file to html and have the tables/graphs/certain outputs showing, but not the code chunks. So far I have been successful with using echo = FALSE or include = FALSE in the start of the code chunk, but in my assumptions graphs the code messages that pop up are being knitted when I don't want them to be. echo=FALSE shows the graphs along with the messages (which i don't want) include=FALSE gets rid of the messages, but also gets rid of the graphs that i need to show. Is there any way around this? I have attached example pictures to demonstrate. Thanks!

the code chunk and its messages

the knitted end result

Upvotes: 1

Views: 1083

Answers (1)

Rookie0101
Rookie0101

Reputation: 17

Near the top you should see the code

knitr::opts_chunk$set(checo = TRUE)

You can add warning = FALSE at the end:

knitr::opts_chunk$set(echo = TRUE, warning = FALSE)

At the very top where it says output: you can also do this

output:
   html_document:
     code_folding: hide

This gives the option to show the code if someone wants to see it, but will hide it initially.

Upvotes: 1

Related Questions