Temporarely hides a block of code with a knitr bite

I am using Markdown via RStudio and knitr to create an R exercise sheet for a course I will give shortly. I want to hide the answer of the exercises, how can we do here on stackoverflow. Example:

This text is hidden

To see this window, you must hover over it. It's easy to do it here (on stackoverflow) by adding >!

up to what you want to hide.

How to hide text in RMarkdown using knitr in RStudio? I would like to hide the whole block of code (script and result)

An example of what I want to create with knitr:

Question 1)

Estimate the average of this vector:

vec1 <- 1:5

      

Answer:

mean(vec1)

 ## 3

+3


source to share





All Articles