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
fit <- lm(len ~ dose, data = Toothdata)
b <- fit$coefficients
plot(len ~ dose, data = Toothdata)
abline(lm(len ~ dose, data = Toothdata))
Guinea Pig Tooth Growth
Make sure that you put a space after the hashtag, otherwise it will not work!
We can also add bullet point-type marks in our r markdown file.
Its important to note here that in R Markdown indentation matters!
We can put really nice quotes into the markdown document. We do this by using the “>” symbol.
” Genes are like the story, and DNA is the language that the story is written in.”
— Samet Soysal
Hyperlinks can also be incorporated into these fileS. This is especially useful in HTML files, since they are in a web browser and will redirect the reader to the material that you are interested in showing them. Here we will use the link to R Markdown’s homepage for this example. RMarkdown
We can also put nice formatted formulas into Markdown using two dollar sings.
Hard-Weinberg Formula
\[p^2 + pq + q^2 = 1\]
And you get really complex as well!
\[\Theta = \begin{pmatrix}\alpha & \beta\\ \gamma & \delta \end{pmatrix}\]
## [1] "Hello World"
There are also options for your R Markdown file on how knitr interprits the code chuck. There are the following options.
Eval (T or F) : whether or not to evaluate the code chuck.
Echo (T or F): Whether or not to show the code for the chunk, but results will still print.
Cache: If enable, the same code chunk 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 (graviphical device) size of the R plots in inches. The figures are first written to the knitr document then to files that are saved separately.
out.width or out.height: The output size of the R plots IN THE R DOCUMENT.
fig.cap: the wrods for the figure caption.
We can also add a table of contents to our HTML Document. We do this by altering the YAML code (the weird code chunk at the VERY top of the document.) We can add this:
You can also 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.
You can also add themes to your HTML document that change the highlighting color and hyperlink color of your html output. This can be nice asthetically. To do this, you change your theme in thre YAML to one of the following.
cerulean journal flatly readable spacetab united cosmo lumen paper sandstone simplex yeti null
You can also change the color by specifying highlight:
default tango payments kate monochrome espresso zenburn haddock textmate
You can also use the code_folding option to allow the reader to toggle between displaing the code and hiding the code. This is done with:
code_folding: hide
There are a TON of options and ways for you to customize your R code using the HTML format. This is also a great wat to display a “portoflio” of you work if you are trying to market yourself to interested parties.
##Kendi deneylerim
months <- array(c("Jan", "Feb", "Marc", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct","Nov", "Dec"), dim=c(3,4))
print(months)
## [,1] [,2] [,3] [,4]
## [1,] "Jan" "Apr" "Jul" "Oct"
## [2,] "Feb" "May" "Aug" "Nov"
## [3,] "Marc" "Jun" "Sep" "Dec"
ABA1A <- list(gene="ABA1a", rna_dizisi = "AUGAATTTAGGCAAAAGU", kodon_sayisi =6)
print(ABA1A)
## $gene
## [1] "ABA1a"
##
## $rna_dizisi
## [1] "AUGAATTTAGGCAAAAGU"
##
## $kodon_sayisi
## [1] 6