Below is a code chunk:
## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 4 5.8 VC 0.5
## 5 6.4 VC 0.5
## 6 10.0 VC 0.5
fit <- lm(len~dose, data = Toothdata)
b <- fit$coefficients
plot(len~dose, data = Toothdata)
abline(lm(len~dose, data = Toothdata))Fig: 1. Guiena Pig Tooth Grwoth
The value of the slope is 9.7635714.
It’s important to note that in R markdown, indentation matters!
by putting “>”
“Genes are like the story, DNA is the language that the story was written in.”
—Sam
We can add formula into markdown using two dollar signs.
\[ p^2+2pq+q^2=1\]
you can get really complex as well!!
\[ \theta = \begin{pmatrix}\alpha & \beta & \zeta\\ \gamma & \epsilon^2 & \mu\\ \end{pmatrix}\]
## [1] "Hello World"
Eval (T or F): whether or not to evaluate the code chunk Echo (T or F): whether or not the show actual chunk, but the result will still print
by altering the YAML code at the very top of the document. we can add this:
title: “HTML_Tutorial” author: “Dr. Myat” date: “2024-05-31” output: html_document: toc: True toc_float: True
This will give us the very nice floating table of content on the right handside of the doucment.
add tabs in our report. we need to specify each section that you want to become a tab by placing “{.tabset}” after the line. Every subsequent header will be a new tab.
You can also add themes to your HTML documents that change the highlighting colour and hyperlink colour of your HTML output. This can be nice esthetically. To do this, you change your theme in the YAML to one of the following:
cerulean journal flatly readable spacelab united cosmo lumen paper sandstone simplex yeti null
You can also change the colour by specifying highlight:
default tango payments kate monochrome espresso zenburn haddock textmate
to allow the reader to toggle between displaying the code and hiding the code. This is done with:
code_folding: hide