-
Notifications
You must be signed in to change notification settings - Fork 0
/
ES240.Rmd
45 lines (32 loc) · 1.06 KB
/
ES240.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
---
title: "Untitled"
author: "Gustavo Facincani Dourado"
date: "2/16/2021"
output: html_document
---
```{r}
precip <- read_csv("C:/Users/gusta/Downloads/sampledata.csv")
precip
```
```{r}
library(ggplot2)
library(ggpmisc)
ggplot(precip, aes(x=year, y = sac_feb_precip_in)) + geom_line()
my.formula <- precip$sac_feb_precip_in ~ precip$mei
ggplot(precip, aes(y= sac_feb_precip_in, x = mei)) + geom_point()+
geom_smooth(method = "lm", se=FALSE, color="black") +#, formula = my.formula) +
stat_poly_eq(formula = my.formula,
eq.with.lhs = "italic(hat(y))~`=`~",
aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")),
parse = TRUE)
```
```{r}
meanprecip <- mean(precip$sac_feb_precip_in)
meanprecip
median(precip$sac_feb_precip_in)
precip2020 <- precip %>% filter(year == "2020")
precip2020$sac_feb_precip_in/meanprecip*100
max(precip$sac_feb_precip_in)
precip %>% filter(sac_feb_precip_in == "0")
cor.test(precip$mei, precip$sac_feb_precip_in, method= "pearson")
```