How to hide code in RMarkdown, with option to see it

后端 未结 2 420
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 06:32

I\'m writing an RMarkdown document in which I\'d like to re-run some chunks (5 to 9). There\'s no need to display these chunks again, so I considered using

         


        
2条回答
  •  感动是毒
    2020-12-13 07:36

    This has been made much easier with the rmarkdown package, which did not exist three years ago. Basically you just turn on "code folding": http://rmarkdown.rstudio.com/html_document_format.html#code_folding. You no longer have to write any JavaScript.

    E.g.

    ---
    title: "Habits"
    output:
      html_document:
        code_folding: hide
    ---
    

提交回复
热议问题