---
title: "My first markdown file"
author: "your name here"
date: "01/15/2019"
output:
  pdf_document: default
  html_document: default
---

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can choose "knit to HTML", "knit to PDF", or "knit to Word"

# 1. Earthquake Data <!note that # is used to make letters bigger>
#<!> is used to comment out things, you will see using larger number of # key, the letter size will become smaller 
##<!> is used to comment out things, you will see using larger number of # key, the letter size will become smaller 
###<!> is used to comment out things, you will see using larger number of # key, the letter size will become smaller 

# 2. Embed R code, use ``` to start and close the R environment, {r eq} is the title of the R chunk, please use different name for each chunk 

```{r eq} 
eq<-c(18,14,10,15,8,15,6,11,8,7,12,11,23,16,15,25,22,20,16,23)
eq 
##note that # inside the r code is to comment out things, not to make letters bigger
#### mean
mean(eq)
#### variance
var(eq)
```
# 3. Pressure data, try Plots now

Pressure is a dataset installed in R, 

```{r pressure}
nrow(pressure) #number of observation of the data
head(pressure) #first 5 data lines
summary(pressure)   #summary statistics
pressure  #full data set
```

```{r plot}
plot(pressure)
```


```{r plot2, echo=FALSE}
plot(pressure)
```

##Note that the `echo = FALSE` was added to the code chunk to prevent printing of the R code that generated the plot.

# 4. Math environment <!we use $$ $$ make the expression centered, using $ $, the expression is left aligned>
$a^2 + b^2 = c^2$
$$H_0: \rho_1 = 0, H_{\alpha}: \rho_1 \neq 0$$ 


\newpage

# 5. Appendix of R code

```{r eval=FALSE}
eq<-c(18,14,10,15,8,15,6,11,8,7,12,11,23,16,15,25,22,20,16,23)
eq  
##note that # inside the r code is to comment out #things
#### mean
mean(eq)
#### variance
var(eq)
#### standard deviation
sd(eq)
#or
sqrt(var(eq))  
#### sorting
sort(eq)
#### quartiles
median(eq)
fivenum(eq)
##Range
range(eq)
##IQR
fivenum(eq)[4] - fivenum(eq)[2]
diff(fivenum(eq)[c(2,4)])
```

