-
Notifications
You must be signed in to change notification settings - Fork 0
/
iso_aggmet.R
66 lines (48 loc) · 2.16 KB
/
iso_aggmet.R
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
library(ggplot2)
library(RColorBrewer)
library(plyr)
### setwd()
wd <- setwd("C:/Users/iotte/Desktop/III_isoIntensive")
### read data
iso <- read.csv("iso_test_traject.csv", sep = ";")
met13 <- read.csv("isoIntensiveDec13.csv", sep = ";")
met14 <- read.csv("isoIntensiveApr14.csv", sep = ";")
### aggregate metdate to isodate
## met13
met13.Ta <- aggregate(met13$Ta_200,
by = list(met13$date_sample, met13$time,
met13$plotID, met13$type),
na.rm = TRUE,
FUN = "mean")
met13.rH <- aggregate(met13$rH_200,
by = list(met13$date_sample, met13$time,
met13$plotID, met13$type),
na.rm = TRUE,
FUN = "mean")
met13.agg <- cbind(met13.Ta, met13.rH)
met13.agg <- met13.agg[, -(6:9)]
colnames(met13.agg) <- c("date_sample", "time", "plot_id_sp1",
"type", "Ta_200", "rH_200")
met13.agg$date_sample <- as.Date(met13.agg$date_sample)
met13.agg.sort <- met13.agg[order(met13.agg$plot_id_sp1, met13.agg$type,
met13.agg$date_sample, met13.agg$time), ]
write.csv2(met13.agg.sort, file = "met13_agg_sort.csv", sep = ";")
## met14
met14.Ta <- aggregate(met14$Ta_200,
by = list(met14$date_sample, met14$time,
met14$plotID, met14$type),
na.rm = TRUE,
FUN = "mean")
met14.rH <- aggregate(met14$rH_200,
by = list(met14$date_sample, met14$time,
met14$plotID, met14$type),
na.rm = TRUE,
FUN = "mean")
met14.agg <- cbind(met14.Ta, met14.rH)
met14.agg <- met14.agg[, -(6:9)]
colnames(met14.agg) <- c("date_sample", "time", "plot_id_sp1",
"type", "Ta_200", "rH_200")
met14.agg$date_sample <- as.Date(met14.agg$date_sample)
met14.agg.sort <- met14.agg[order(met14.agg$plot_id_sp1, met14.agg$type,
met14.agg$date_sample, met14.agg$time), ]
write.csv2(met14.agg.sort, file = "met14_agg_sort.csv", sep = ";")