I'm using Markdown through RStudio and knitr to built a R exercises sheet for a course I'll give soon. I want to hide the answer of the exercises like we can do here on stackoverflow. example:
This text his hidden
To see the box before, you have to put your cursor over it. This is easily done here (on stackoverflow) by adding >!
before what your want to hide.
How to I hide text like that in RMarkdown using knitr in RStudio? I would like to hide the entire code block (the script and the result)
Example of what I want to produce with knitr:
Question 1)
Evaluate the mean of this vector:
vec1 <- 1:5
Answer:
mean(vec1)
## 3