/
IntroToR3.Rmd
70 lines (57 loc) · 2.18 KB
/
IntroToR3.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "R markdown report"
author: "Malachy Campbell"
date: "`r Sys.Date()`"
output:
rmdformats::html_clean:
fig_width: 6
fig_height: 6
highlight: kate
thumbnails: true
lightbox: true
gallery: true
---
```{r setup, include=FALSE}
knitr::opts_knit$set(root.dir = '~/Desktop/')
```
# Background
The purpose of this is to show everyone how markdown works. The first header is called "Background".
## This is a subheader
Here, I'll show how to change the font style and create an itemized list.
* One asterisk for *italic*
- Subitem
* Two for **bold**
* tildes for ~~strike through~~.
### Code chunks
#### R code
To specify a chunk of code start with ```{engine, evaluate code?, show code?...} and end with ```. This is a chunk of R code. The engine is R, we will run the code, and show the output.
```{r code example, eval = T, echo=T}
HiR <- "Hi from R!!"
print(HiR)
```
#### bash code
We can also call bash codes from inside our markdown document. Here the engine is bash, so we change the first line accordingly.
```{bash hi example, echo=T}
echo 'Hi, its me again!'
```
```{bash quiet hi example, eval=F, echo=T}
echo 'Hi, its me again, but this time there no output :('
```
# Show some plots
This is a plot aligned to the left.
```{r plot hist, echo=T, fig.align='left', fig.height=4, fig.width=3}
hist(rnorm(100, 10, 2), breaks = 20)
```
Here's one to the right.
```{r plot hist2, echo=T, fig.align='right', fig.height=3, fig.width=4}
hist(rnorm(100, 10, 2), breaks = 20)
```
# Displaying formulas using latex
Enclosing some latex code in one \$ will produce an inline formula $y = x + e$. If you use two \$ it will be placed beneath the text $$ y = x + e $$
Online equation builders can be helpful for beginners check one out [here](https://www.codecogs.com/latex/eqneditor.php).
# More resources for learning R
Here are a few links for users that are new to R.
* [R for cats](https://rforcats.net/)
* [An Introduction to R](https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf): A comprehensive guide to using R.
* [R for data science](https://r4ds.had.co.nz)
* [Stack overflow](https://stackoverflow.com/questions/tagged/r) : A place to ask questions, and find answers