forked from EcoRProg/OpenSciRProg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImportaChla.Rmd
56 lines (34 loc) · 1.5 KB
/
ImportaChla.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
---
title: "Importar Datos Chla"
author: "L.A.S."
date: "July 17, 2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Importa Chla
```{r importaChla}
source("R/functions.r")
chla <- read.delim("Data/Clorofila.txt", stringsAsFactors = FALSE)
require(lubridate)
fixedChla <- fixChlorophyllData(chla)
require(ggplot2)
require(tidyr)
range(fixedChla$IntegE1,na.rm = TRUE)
ChlaRearranged <- gather(fixedChla,IntegE1,IntegE2, key="Station",value="ChlaInteg" )
ggplot(ChlaRearranged, aes(Date, ChlaInteg, color=Station)) + theme_classic() + scale_y_log10() + geom_point()
ggplot(ChlaRearranged, aes(Date, ChlaInteg, color=Station)) + theme_classic() +
scale_y_log10() + geom_point() + geom_line()+ facet_wrap( ~Station) +
scale_color_brewer(palette="Dark2") + stat_smooth(se=FALSE)
require(dplyr)
ChlaRearranged <- ChlaRearranged %>% mutate(Month=month(Date))
chlaByMonth <- ChlaRearranged %>% filter(!is.na(Month)) %>% group_by(Year,Month) %>% summarise(ChlaInteg=mean(ChlaInteg, na.rm = TRUE))
str(chlaByMonth)
ggplot(chlaByMonth, aes(factor(Month), ChlaInteg, color=factor(Year))) + theme_classic() +
scale_y_log10() + geom_point()
ggplot(chlaByMonth, aes(Year, ChlaInteg, color=factor(Month))) + theme_classic() +
scale_y_log10() + geom_point() + geom_line()
ggplot(chlaByMonth, aes(Year, ChlaInteg, color=factor(Month))) + theme_classic() +
geom_point() + geom_line() + facet_wrap(~Month) + stat_quantile(quantiles = 0.5)
```