temp <- read.csv("Temperature.csv")Temperature and Salinity Analysis
Introduction
This report summarizes an analysis of temperature and salinity data collected over several years and stations. The goal is to compute descriptive statistics and explore how values vary across time and space.
Read the data
The mean and standard deviation for temperature and salinity
mean(temp$Temperature, na.rm = TRUE)[1] 12.20743
sd(temp$Temperature, na.rm = TRUE)[1] 5.412521
mean(temp$Salinity, na.rm = TRUE)[1] 29.70221
sd(temp$Salinity, na.rm = TRUE)[1] 5.421593
I estimated the mean and standard deviation for temperature and salinity across all samples. Also, I added the parameter na.rm=TRUE to remove these from the calculation of mean/std. dev. because this dataset has some missing values (NA).
The average values of temperature and salinity
a) all sites
tapply(temp$Temperature, temp$Station, mean, na.rm = TRUE) DANT DREI G6 GROO HAMM HANS HUIB LODS
12.05908 12.77160 10.66570 12.25853 12.50000 13.54894 11.85353 12.61192
MARS N02 N10 N20 N70 R03 R50 R70
12.39607 11.37433 12.45878 12.19753 12.14789 12.80000 13.94911 13.98022
SOEL T004 T010 T100 T135 T175 T235 VLIS
13.21203 11.28425 12.37517 11.94766 11.75512 11.55431 11.32355 12.79292
W02 W20 W70 WISS ZIJP ZUID
10.51829 11.87937 12.18243 12.45090 12.55904 11.83928
tapply(temp$Salinity, temp$Station, mean, na.rm = TRUE) DANT DREI G6 GROO HAMM HANS HUIB LODS
28.94468 29.83813 30.59610 14.57571 31.35738 18.29124 29.52631 30.73000
MARS N02 N10 N20 N70 R03 R50 R70
28.03457 28.78695 30.45223 31.93275 34.94147 30.54978 33.49888 33.67944
SOEL T004 T010 T100 T135 T175 T235 VLIS
18.09477 32.08114 32.72095 34.56746 34.67667 34.75135 34.87812 29.55476
W02 W20 W70 WISS ZIJP ZUID
32.05992 33.31554 35.02006 31.75164 29.39230 28.83997
b) all years
tapply(temp$Temperature, temp$Year, mean, na.rm = TRUE) 1990 1991 1992 1993 1994 1995 1996 1997
11.99146 11.00885 11.55799 11.45385 12.07944 12.32080 10.72728 12.33687
1998 1999 2000 2001 2002 2003 2004 2005
12.13386 13.10577 12.61539 12.74162 13.05500 12.69017 12.56788 12.56112
tapply(temp$Salinity, temp$Year, mean, na.rm = TRUE) 1990 1991 1992 1993 1994 1995 1996 1997
30.89873 30.88625 30.27116 29.52839 29.07707 28.94954 30.66670 30.54525
1998 1999 2000 2001 2002 2003 2004 2005
29.55748 29.03291 28.99534 28.22390 28.89323 29.60946 30.45629 30.35355
I estimated the average values of temperature and salinity across a) all sites and b) all years by using tapply().
The average monthly values of temperature and salinity by year across all sites
aggregate(temp[, c("Temperature", "Salinity")], list(Year = temp$Year, Month = temp$Month), mean, na.rm = TRUE) Year Month Temperature Salinity
1 1990 1 6.313889 30.27000
2 1991 1 5.210000 29.77267
3 1992 1 5.858140 29.99535
4 1993 1 4.965217 28.19087
5 1994 1 5.691111 27.31000
6 1995 1 5.778000 27.97180
7 1996 1 3.645238 30.66524
8 1997 1 2.146857 31.24865
9 1998 1 6.685926 30.24886
10 1999 1 5.717778 28.94469
11 2000 1 5.622963 28.49000
12 2001 1 4.754375 29.25000
13 2002 1 4.427778 28.19519
14 2003 1 4.848485 28.65606
15 2004 1 5.558636 28.64591
16 2005 1 5.877692 30.72360
17 1990 2 6.475000 27.94625
18 1991 2 3.576923 30.51923
19 1992 2 5.040625 30.47500
20 1993 2 5.231111 27.25280
21 1994 2 4.814706 28.97088
22 1995 2 6.400000 25.15593
23 1996 2 1.751351 30.01189
24 1997 2 2.793600 28.73720
25 1998 2 5.023438 30.55347
26 1999 2 4.280000 26.74842
27 2000 2 5.635517 28.62345
28 2001 2 5.717826 26.99696
29 2002 2 7.634286 26.19952
30 2003 2 3.864545 26.75606
31 2004 2 5.739286 25.41143
32 2005 2 4.670455 29.20818
33 1990 3 8.192857 30.22250
34 1991 3 5.286207 30.27966
35 1992 3 6.525806 30.16500
36 1993 3 5.521622 28.32056
37 1994 3 5.815686 27.95980
38 1995 3 6.800000 28.45118
39 1996 3 2.950000 30.35333
40 1997 3 6.747551 30.33224
41 1998 3 6.965862 26.51448
42 1999 3 6.684898 27.82719
43 2000 3 6.984773 26.74886
44 2001 3 5.268108 27.01111
45 2002 3 7.487778 27.08886
46 2003 3 6.042927 27.52780
47 2004 3 5.784407 29.26576
48 2005 3 5.051000 29.38240
49 1990 4 9.153333 30.80133
50 1991 4 8.365714 30.84543
51 1992 4 8.030769 29.69103
52 1993 4 8.584615 29.49949
53 1994 4 7.742857 27.25381
54 1995 4 8.386364 28.28159
55 1996 4 6.392683 29.99561
56 1997 4 8.507045 29.89523
57 1998 4 8.965862 30.20926
58 1999 4 10.036364 26.46606
59 2000 4 8.857907 27.78628
60 2001 4 8.117222 25.79417
61 2002 4 9.589038 29.27327
62 2003 4 9.197736 29.42528
63 2004 4 9.695370 30.29222
64 2005 4 9.044444 29.66933
65 1990 5 14.357576 30.71281
66 1991 5 10.185000 29.63042
67 1992 5 12.074324 29.55811
68 1993 5 13.170270 30.34541
69 1994 5 11.987097 29.02492
70 1995 5 11.572549 29.05375
71 1996 5 10.101429 30.96757
72 1997 5 12.223214 29.87750
73 1998 5 13.181455 30.07436
74 1999 5 13.028776 28.90551
75 2000 5 13.255000 29.11696
76 2001 5 12.031867 27.69520
77 2002 5 12.416441 28.68169
78 2003 5 13.620857 27.61743
79 2004 5 12.478364 30.51545
80 2005 5 11.883061 29.39306
81 1990 6 16.277273 31.01000
82 1991 6 13.059259 31.08407
83 1992 6 16.887838 30.35611
84 1993 6 16.024390 30.54561
85 1994 6 14.637255 28.83816
86 1995 6 14.632609 28.32043
87 1996 6 14.996364 30.93800
88 1997 6 15.570200 30.86431
89 1998 6 16.557660 29.16064
90 1999 6 16.019091 29.79455
91 2000 6 15.611111 29.80463
92 2001 6 15.330877 28.86246
93 2002 6 16.343036 29.54439
94 2003 6 18.874643 27.59964
95 2004 6 15.784259 30.69167
96 2005 6 15.061846 30.86169
97 1990 7 17.423333 31.43033
98 1991 7 17.724324 30.83892
99 1992 7 18.745000 30.59800
100 1993 7 17.142857 30.94595
101 1994 7 19.314035 30.38172
102 1995 7 18.335849 29.41472
103 1996 7 16.509091 31.25352
104 1997 7 18.483594 30.05484
105 1998 7 17.108049 29.86098
106 1999 7 18.442623 30.31197
107 2000 7 16.645918 29.52940
108 2001 7 19.071818 29.14891
109 2002 7 17.872241 30.07845
110 2003 7 19.644000 31.02720
111 2004 7 17.292632 31.00930
112 2005 7 18.799111 30.15822
113 1990 8 18.976667 31.99467
114 1991 8 19.550000 31.43059
115 1992 8 18.905000 30.80000
116 1993 8 17.376316 30.53184
117 1994 8 19.903065 30.16051
118 1995 8 20.385000 29.85034
119 1996 8 18.390741 31.21519
120 1997 8 20.919815 30.58132
121 1998 8 18.749200 30.79800
122 1999 8 19.174603 30.69317
123 2000 8 18.756102 29.97169
124 2001 8 19.292273 30.04818
125 2002 8 20.403500 29.98167
126 2003 8 21.038269 31.83269
127 2004 8 19.780185 31.41574
128 2005 8 17.692105 30.64439
129 1990 9 16.831250 30.41125
130 1991 9 17.896000 31.36160
131 1992 9 15.958621 31.25241
132 1993 9 15.660526 28.51892
133 1994 9 15.753846 30.61487
134 1995 9 17.243902 29.36300
135 1996 9 15.953191 30.43723
136 1997 9 17.910833 30.03083
137 1998 9 15.998444 30.19549
138 1999 9 18.999268 30.03122
139 2000 9 17.424048 29.35476
140 2001 9 15.645429 27.70486
141 2002 9 18.297895 29.12079
142 2003 9 17.982400 31.38060
143 2004 9 16.174694 31.03040
144 2005 9 17.883455 31.44145
145 1990 10 13.851724 31.91690
146 1991 10 13.647727 31.58044
147 1992 10 13.095135 31.80270
148 1993 10 13.648485 30.09182
149 1994 10 12.884375 30.50844
150 1995 10 15.133333 30.29039
151 1996 10 13.725000 31.50750
152 1997 10 13.920000 31.62538
153 1998 10 11.752941 26.48765
154 1999 10 13.080385 29.21885
155 2000 10 13.697297 29.77703
156 2001 10 14.866410 28.18974
157 2002 10 13.262703 27.88711
158 2003 10 12.246765 30.37000
159 2004 10 12.790000 31.61171
160 2005 10 14.498125 30.68656
161 1990 11 10.345161 31.53484
162 1991 11 8.400000 31.11848
163 1992 11 8.900833 28.24167
164 1993 11 8.580000 29.79150
165 1994 11 11.212195 28.81049
166 1995 11 11.479487 30.25692
167 1996 11 9.386410 30.36205
168 1997 11 10.031200 31.85209
169 1998 11 9.037097 27.67930
170 1999 11 7.207857 28.35071
171 2000 11 9.189630 29.72741
172 2001 11 10.069130 27.49217
173 2002 11 10.565357 28.56679
174 2003 11 9.401000 31.03300
175 2004 11 10.301786 31.16250
176 2005 11 11.562759 31.25586
177 1990 12 6.766667 31.10160
178 1991 12 6.556757 31.42028
179 1992 12 7.576977 29.92356
180 1993 12 5.532258 28.58935
181 1994 12 9.012821 28.97487
182 1995 12 5.417143 29.41657
183 1996 12 6.581818 29.53676
184 1997 12 6.399259 31.20455
185 1998 12 6.080741 29.48020
186 1999 12 5.637200 28.57640
187 2000 12 7.550952 27.88381
188 2001 12 7.821786 28.03893
189 2002 12 5.246552 29.41345
190 2003 12 6.464762 29.75091
191 2004 12 7.444643 30.50429
192 2005 12 7.111481 30.53444
I estimated the average monthly values of temperature and salinity by year across all sites to make a time series by using aggregate().
The number of observations
at each station
table(temp$Station)
DANT DREI G6 GROO HAMM HANS HUIB LODS MARS N02 N10 N20 N70 R03 R50 R70
300 293 278 296 295 309 296 294 296 402 665 266 268 161 106 106
SOEL T004 T010 T100 T135 T175 T235 VLIS W02 W20 W70 WISS ZIJP ZUID
295 339 261 258 259 258 258 421 272 191 190 296 296 303
for each year
table(temp$Year)
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
367 392 438 436 590 590 583 636 608 570 563 568 545 550 540 552
at each station per year
table(temp$Station, temp$Year)
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
DANT 12 12 18 19 17 13 19 20 22 21 22 21 21 21
DREI 13 13 13 13 19 21 20 20 21 20 20 20 20 20
G6 12 16 20 17 21 24 23 28 23 21 13 12 12 12
GROO 12 12 18 19 17 12 18 19 21 21 21 21 21 21
HAMM 13 13 13 13 20 21 20 21 20 20 21 20 20 20
HANS 13 16 13 13 21 24 19 19 18 18 29 29 20 19
HUIB 12 11 18 19 17 12 19 19 21 21 21 22 21 21
LODS 13 13 13 13 20 21 20 21 20 20 20 20 20 20
MARS 12 12 18 18 16 12 19 19 22 21 21 21 21 21
N02 12 17 20 17 27 29 31 40 37 29 24 27 23 23
N10 47 45 40 46 53 56 43 52 45 43 36 37 30 31
N20 12 12 11 11 18 18 18 18 18 18 19 19 19 19
N70 12 11 11 11 18 18 18 18 18 19 18 20 20 19
R03 0 5 7 7 13 17 17 23 20 9 8 7 7 7
R50 0 5 7 7 10 7 7 7 7 7 7 7 7 7
R70 0 5 7 7 10 7 7 7 7 7 7 7 7 7
SOEL 13 13 13 12 20 22 20 21 20 20 20 20 20 20
T004 12 14 20 16 26 27 27 33 28 20 19 19 19 20
T010 12 10 11 10 18 18 18 18 18 18 18 18 18 19
T100 12 10 10 10 18 18 18 18 18 18 18 18 18 18
T135 12 10 10 10 18 18 18 18 18 18 17 19 18 19
T175 12 10 10 10 18 18 18 18 18 18 18 18 18 18
T235 12 10 10 10 18 18 18 18 18 18 18 18 18 18
VLIS 14 18 21 24 35 36 22 23 22 22 30 31 30 32
W02 12 17 20 17 21 23 23 28 23 16 12 12 12 12
W20 12 12 11 11 12 12 12 12 12 13 12 12 12 12
W70 12 12 11 11 12 12 12 12 12 12 12 12 12 12
WISS 13 13 13 13 20 21 20 22 20 20 21 20 20 20
ZIJP 13 13 13 13 20 21 20 23 20 20 20 20 20 20
ZUID 11 12 18 19 17 14 19 21 21 22 21 21 21 22
2004 2005
DANT 21 21
DREI 20 20
G6 12 12
GROO 21 22
HAMM 20 20
HANS 19 19
HUIB 21 21
LODS 20 20
MARS 21 22
N02 22 24
N10 29 32
N20 17 19
N70 18 19
R03 7 7
R50 7 7
R70 7 7
SOEL 20 21
T004 19 20
T010 18 19
T100 18 18
T135 18 18
T175 18 18
T235 18 18
VLIS 31 30
W02 12 12
W20 12 12
W70 12 12
WISS 20 20
ZIJP 20 20
ZUID 22 22
I determined the number of observations at each station/for each year/at each station per year by using table().