You can enrich your comments by using Markdown syntax. Html_document --- This is an R Markdown document. In side a text chunk you can use mathematical notation if you surround it by dollar signs for inline mathematics and for displayed equations.
Html_document --- This is an R Markdown document.
Instead use a programmers file editor such as Emacs Notepad or an integrated development environment such as RStudio to edit the file. R code to show how the analyses have been done. Do not leave a space between the and your mathematical notation. An R markdown file is suffixed Rmd.