-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain
62 lines (48 loc) · 1.89 KB
/
Main
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
########################################################################################
##
## ENV400 example script
## 2016 Mar
##
########################################################################################
## ------------------------------------------------------------------------
library(dplyr)
library(reshape2)
library(chron)
library(ggplot2)
## ------------------------------------------------------------------------
source("GRB001.R")
## ------------------------------------------------------------------------
Sys.setlocale("LC_TIME","C")
options(stringsAsFactors=FALSE)
options(chron.year.abb=FALSE)
theme_set(theme_bw()) # just my preference for plots
## ------------------------------------------------------------------------
filename <- "2015/LAU.csv"
file.exists(filename)
## ------------------------------------------------------------------------
data <- read.table(filename,sep=";",skip=6,
col.names=c("datetime","O3","NO2","CO","PM10","TEMP","PREC","RAD"))
## ------------------------------------------------------------------------
head(data)
## ------------------------------------------------------------------------
str(data)
## ---- results='asis'-----------------------------------------------------
ColClasses(data)
## ------------------------------------------------------------------------
data[,"datetime"] <- as.chron(data[,"datetime"], "%d.%m.%Y %H:%M")
data[,"month"] <- months(data[,"datetime"])
data[,"date"] <- dates(data[,"datetime"])
## ------------------------------------------------------------------------
head(data)
str(data)
## ---- results='asis'-----------------------------------------------------
ColClasses(data)
## ---- fig.width=8, fig.height=5------------------------------------------
ggp <- ggplot(data)+
geom_line(aes(datetime, O3))+
scale_x_chron()
print(ggp)
dir.create("outputs")
pdf("outputs/fig1.pdf")
print(ggp)
dev.off()