this is a tutolrial on how to u r markdown for reasearch here we can type long sentences without tags
will be using the toothgrowth dataset. in this exp guinea pigs were given vit c to check teeth growth
to run our code in a markdown file, we need to dentonate the section that is considered as R code these are called ‘code chunks’
Below are code chunk:
Toothdata <- ToothGrowth
head(Toothdata)
## 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
once u press play the results pops out
fit <- lm(len ~ dose, data = Toothdata)
b <- fit$coefficients
plot(len ~ dose , data = Toothdata)
abline(lm(len ~ dose, data = Toothdata))
pig tooth growth
The slope of the regression line is 9.7635714
we can put sections and subsections in our r markdown file, similar to numbers or bullet points in a word doc. done by using #
space after hash tag
we can add bullet points
Its imp to note that indentations matters
we can put formulas using two dollar signs
\[p^2 + 2pq + q^2 = 1\]
complex as well
\[\Theta = \begin{pmatrix}\alpha & \beta\\ \gamma & \delta \end{pmatrix}\] latex codes are used for formulas
There are also options for your R Markdown file on how knitr interprits the code chunk. There are the following options.
print("hello world")
## [1] "hello world"
print("hello world")
## [1] "hello world"
Eval (T or F): weather or not to evaluate code chunk
Echo (T or F) prints out put but not the code
cache: if enable, the same code chuck will not be evaluated the next time that the knitr is run. Great for code that has long run times
fig.width or fig.height: the (graphical device) size of the R plots in inches. the figures are first written document then to files that are saved separately.
out.width or out.height: The output size of the r plots in R documents.
fig.cap: words for the fig caption
we can also add table of contents to our HTML Documents. we do this by altering the YAML code (the stupid code on very top ) we can add this:
title: “HTML_Tutorial” author: “akash” date: “2023-11-23” output: html_document: toc: true toc_float: true
This gives us a very floating table of contents on the right hand side of the doc.
##Tabs
You can add TABS in our report. To do this you 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.
##Themes
you can also add themes to your HTML documents that change the highlighting color and hyperlink color of your html output. this can be nice asthetically. to do this, you can change your theme in YAML to one of the following:
cerulean journal flantly readable spacelab united cosmo lumen paper sandstone simplex yeti null
you can also change the color by specifying highlights:
default tango payments kate monochrome espresso zenburn haddock textmate
##code folding
you can use the code folding option to allow the reader to toggle between displaying the code and hiding the code. This is done with:
code_folding: hide
There are a TON of options and ways for you to costomize yor