Install the package: devtools devtools::install_github(“troyhill/VulnToolkit”)
library(VulnToolkit)
library(maps)
First, clear variables and any open plots before starting.
graphics.off()
rm(list=ls())
Set your working directory:
setwd("C:\\Users\\Ledi\\Documents\\OceanR")
Ballycotton <- read.csv(file.path(getwd(),"ballycotton_harbour.csv"),skip = 1,header=TRUE)
print(dim(Ballycotton))
## [1] 616525 6
print(colnames(Ballycotton))
## [1] "degrees_east" "degrees_north" "UTC" "X"
## [5] "m" "X.1"
print(head(Ballycotton))
## degrees_east degrees_north UTC X
## 1 -8.0007 51.8278 2010-10-07T15:06:00Z Ballycotton Harbour
## 2 -8.0007 51.8278 2010-10-07T15:12:00Z Ballycotton Harbour
## 3 -8.0007 51.8278 2010-10-07T15:18:00Z Ballycotton Harbour
## 4 -8.0007 51.8278 2010-10-07T15:24:00Z Ballycotton Harbour
## 5 -8.0007 51.8278 2010-10-07T15:30:00Z Ballycotton Harbour
## 6 -8.0007 51.8278 2010-10-07T15:36:00Z Ballycotton Harbour
## m X.1
## 1 1.419 1
## 2 1.481 1
## 3 1.596 1
## 4 1.600 1
## 5 1.666 1
## 6 1.772 1
Rename some of these variables:
names(Ballycotton)<-c("lon","lat","time","name","h","flag")
Pull out some of the variables:
BC.lat <- Ballycotton$lat[1]
BC.lon <- Ballycotton$lon[1]
map("world",c("ireland","uk"),fill=TRUE,xlim=c(-12,-4),ylim=c(51,56))
map.axes(cex.axis=1)
title(main="Location of Ballycotton Tide Gauge",xlab="Longitude",ylab="Latitude")
points(BC.lon,BC.lat,pch=21,col="gray",bg="red")
text(BC.lon-.5,BC.lat,"Ballycotton.",col="gray")
What does this format look like? YYYY-mm-ddT
Ballycotton.time <- as.POSIXlt(Ballycotton$time, format="%Y-%m-%dT%H:%M:%SZ",tz='UTC')
with variables year, month, day, hour, minute, second, sea level (h), and flag.
Ballycotton <- data.frame("time"=Ballycotton.time,
"year"=Ballycotton.time$year+1900,
"month"=Ballycotton.time$mon+1,
"day"=Ballycotton.time$mday,
"hour"=Ballycotton.time$hour+1,
"min"=Ballycotton.time$min,
"sec"=Ballycotton.time$sec,
"h"=Ballycotton$h,
"flag"=Ballycotton$flag)
Before aggregating by hour, chop off uneven bits at start and end.
head(Ballycotton,n=11) # tells us to get rid of first variable ##10 - start
## time year month day hour min sec h flag
## 1 2010-10-07 15:06:00 2010 10 7 16 6 0 1.419 1
## 2 2010-10-07 15:12:00 2010 10 7 16 12 0 1.481 1
## 3 2010-10-07 15:18:00 2010 10 7 16 18 0 1.596 1
## 4 2010-10-07 15:24:00 2010 10 7 16 24 0 1.600 1
## 5 2010-10-07 15:30:00 2010 10 7 16 30 0 1.666 1
## 6 2010-10-07 15:36:00 2010 10 7 16 36 0 1.772 1
## 7 2010-10-07 15:42:00 2010 10 7 16 42 0 1.853 1
## 8 2010-10-07 15:48:00 2010 10 7 16 48 0 1.874 1
## 9 2010-10-07 15:54:00 2010 10 7 16 54 0 1.933 1
## 10 2010-10-07 16:00:00 2010 10 7 17 0 0 2.053 1
## 11 2010-10-07 16:06:00 2010 10 7 17 6 0 2.055 1
tail(Ballycotton,n=11) # tells us to get rid of length(dub[,1]) - 9 ##616514 - end
## time year month day hour min sec h flag
## 616515 2019-02-20 15:00:00 2019 2 20 16 0 0 -0.108 0
## 616516 2019-02-20 15:05:00 2019 2 20 16 5 0 -0.048 0
## 616517 2019-02-20 15:10:00 2019 2 20 16 10 0 -0.001 0
## 616518 2019-02-20 15:15:00 2019 2 20 16 15 0 0.120 0
## 616519 2019-02-20 15:20:00 2019 2 20 16 20 0 0.243 0
## 616520 2019-02-20 15:25:00 2019 2 20 16 25 0 0.325 0
## 616521 2019-02-20 15:30:00 2019 2 20 16 30 0 0.374 0
## 616522 2019-02-20 15:35:00 2019 2 20 16 35 0 0.439 0
## 616523 2019-02-20 15:40:00 2019 2 20 16 40 0 0.580 0
## 616524 2019-02-20 15:45:00 2019 2 20 16 45 0 0.667 0
## 616525 2019-02-20 15:50:00 2019 2 20 16 50 0 0.727 0
Ballycotton.sub <- Ballycotton[10:616514,]
Ballycotton.hour <- aggregate(h~hour+day+month+year,Ballycotton.sub,mean)
head(Ballycotton.hour)
## hour day month year h
## 1 17 7 10 2010 2.1340
## 2 18 7 10 2010 2.0724
## 3 19 7 10 2010 1.5126
## 4 20 7 10 2010 0.6182
## 5 21 7 10 2010 -0.3026
## 6 22 7 10 2010 -1.0715
tail(Ballycotton.hour)
## hour day month year h
## 61594 10 20 2 2019 -0.5688333
## 61595 11 20 2 2019 -1.3456667
## 61596 12 20 2 2019 -1.8886667
## 61597 13 20 2 2019 -2.0995833
## 61598 14 20 2 2019 -1.7275000
## 61599 15 20 2 2019 -0.7740000
summary(Ballycotton.hour)
## hour day month year
## Min. : 1.00 Min. : 1.00 Min. : 1.000 Min. :2010
## 1st Qu.: 7.00 1st Qu.: 8.00 1st Qu.: 3.000 1st Qu.:2012
## Median :13.00 Median :16.00 Median : 6.000 Median :2014
## Mean :12.51 Mean :15.73 Mean : 6.246 Mean :2014
## 3rd Qu.:19.00 3rd Qu.:23.00 3rd Qu.: 9.000 3rd Qu.:2016
## Max. :24.00 Max. :31.00 Max. :12.000 Max. :2019
## h
## Min. :-3.5020
## 1st Qu.:-1.1159
## Median :-0.1767
## Mean :-0.1643
## 3rd Qu.: 0.7951
## Max. : 2.5312
Before aggregating by month, chop off uneven bits at start and end:
head(Ballycotton.hour) # tells us to get rid of first variable ## 585
## hour day month year h
## 1 17 7 10 2010 2.1340
## 2 18 7 10 2010 2.0724
## 3 19 7 10 2010 1.5126
## 4 20 7 10 2010 0.6182
## 5 21 7 10 2010 -0.3026
## 6 22 7 10 2010 -1.0715
tail(Ballycotton.hour,n=11) # tells us to get rid of length(dub[,1]) - 9 ## 61128
## hour day month year h
## 61589 5 20 2 2019 1.5984167
## 61590 6 20 2 2019 2.0108333
## 61591 7 20 2 2019 1.9210000
## 61592 8 20 2 2019 1.3400000
## 61593 9 20 2 2019 0.3709167
## 61594 10 20 2 2019 -0.5688333
## 61595 11 20 2 2019 -1.3456667
## 61596 12 20 2 2019 -1.8886667
## 61597 13 20 2 2019 -2.0995833
## 61598 14 20 2 2019 -1.7275000
## 61599 15 20 2 2019 -0.7740000
min(which(Ballycotton.hour$year==2010&Ballycotton.hour$month==11))
## [1] 585
max(which(Ballycotton.hour$year==2019&Ballycotton.hour$month==1))
## [1] 61128
Ballycotton.B <- Ballycotton.hour[585:61128,]
Create a new empty column for a decimal year. Add a decimal year variable.
Ballycotton.hour <- cbind(Ballycotton.B, NA)
names(Ballycotton.hour) <- c("hour","day","month", "year", "h", "time")
Ballycotton.hour$time <- as.POSIXlt(sprintf("%s/%s/%s %s",
Ballycotton.hour$year, Ballycotton.hour$month,
Ballycotton.hour$day, Ballycotton.hour$hour),
format="%Y/%m/%d %H",tz='UTC')
summary(Ballycotton.hour)
## hour day month year
## Min. : 1.00 Min. : 1.00 Min. : 1.000 Min. :2010
## 1st Qu.: 7.00 1st Qu.: 8.00 1st Qu.: 3.000 1st Qu.:2012
## Median :13.00 Median :16.00 Median : 6.000 Median :2014
## Mean :12.51 Mean :15.74 Mean : 6.243 Mean :2014
## 3rd Qu.:19.00 3rd Qu.:23.00 3rd Qu.: 9.000 3rd Qu.:2016
## Max. :24.00 Max. :31.00 Max. :12.000 Max. :2019
## h time
## Min. :-3.5020 Min. :2010-11-01 01:00:00
## 1st Qu.:-1.1168 1st Qu.:2012-11-04 16:45:00
## Median :-0.1782 Median :2014-11-20 11:30:00
## Mean :-0.1654 Mean :2014-10-05 01:05:00
## 3rd Qu.: 0.7943 3rd Qu.:2016-08-12 14:15:00
## Max. : 2.5312 Max. :2019-02-01 00:00:00
head(Ballycotton.hour)
## hour day month year h time
## 585 1 1 11 2010 0.9782 2010-11-01 01:00:00
## 586 2 1 11 2010 0.6517 2010-11-01 02:00:00
## 587 3 1 11 2010 0.1715 2010-11-01 03:00:00
## 588 4 1 11 2010 -0.2896 2010-11-01 04:00:00
## 589 5 1 11 2010 -0.7178 2010-11-01 05:00:00
## 590 6 1 11 2010 -1.0464 2010-11-01 06:00:00
tail(Ballycotton.hour)
## hour day month year h time
## 61123 19 31 1 2019 -0.2244167 2019-01-31 19:00:00
## 61124 20 31 1 2019 -0.6590833 2019-01-31 20:00:00
## 61125 21 31 1 2019 -0.9060833 2019-01-31 21:00:00
## 61126 22 31 1 2019 -0.8880000 2019-01-31 22:00:00
## 61127 23 31 1 2019 -0.5561667 2019-01-31 23:00:00
## 61128 24 31 1 2019 0.0287500 2019-02-01 00:00:00
Much mean sea level analyses use monthly values
Repeat the previous two steps (subsetting i.e. chop the data so you average full months - you will need to use which here, aggregating, add time back in) to create monthly means.
Ballycotton.Month <- aggregate(h~month+year,Ballycotton.hour,mean)
head(Ballycotton.Month)
## month year h
## 1 11 2010 -0.0431840
## 2 12 2010 -0.1122131
## 3 1 2011 -0.1600434
## 4 2 2011 -0.1157454
## 5 3 2011 -0.2642659
## 6 4 2011 -0.2185100
tail(Ballycotton.Month)
## month year h
## 83 2 2018 -0.33882898
## 84 3 2018 -0.06335745
## 85 4 2018 0.03586950
## 86 11 2018 0.04846363
## 87 12 2018 -0.06146549
## 88 1 2019 -0.24726392
Create a new empty column for time:
Ballycotton.Month <- cbind(Ballycotton.Month, NA)
names(Ballycotton.Month) <- c("month", "year", "h", "time")
Add a POSIXlt variable back in:
Ballycotton.Month$time <- as.POSIXlt(sprintf("%s/%s/15", Ballycotton.Month$year, Ballycotton.Month$month),tz="UTC")
Ballycotton.Month <- cbind(Ballycotton.Month, NA, NA, NA, NA)
names(Ballycotton.Month) <- c("month", "year", "h", "time",
"mhw","mlw","mtl","n")
for(j in 1:length(Ballycotton.Month$month)){
ind <- which(Ballycotton.hour$year == Ballycotton.Month$year[j] &
Ballycotton.hour$month==Ballycotton.Month$month[j])
t <- Ballycotton.hour$time[ind]
h <- Ballycotton.hour$h[ind]
plot(t,h,type='l')
hl<-HL(h,t)
HL.plot(h,t)
cat("you are on index ", j, " of ", length(Ballycotton.Month$month), "\n")
cat("in ", Ballycotton.Month$year[j], "month = ", Ballycotton.Month$month[j],"\n")
cat("you have ", length(hl$level[hl$tide == "H"])," high tides\n")
cat("you have ", length(hl$level[hl$tide == "L"])," low tides")
# pull out high and low for later
HH<-hl$level[hl$tide == "H"]
LL<-hl$level[hl$tide == "L"]
question1 <- readline("Do the numbers of high tides match low (Y/N)")
if(regexpr(question1, 'y', ignore.case = TRUE) == 1){
Ballycotton.Month$mhw[j] <- mean(HH)
Ballycotton.Month$mlw[j] <- mean(LL)
Ballycotton.Month$mtl[j] <- mean(c(HH,LL))
Ballycotton.Month$n[j] <- length(LL)
continue = TRUE
next
} else if (regexpr(question1, 'n', ignore.case = TRUE) == 1){
question2 <- readline("Would you like to cut out a high or a low tide? (h/l/o)")
if(regexpr(question2, 'h', ignore.case = TRUE) == 1){
Ballycotton.Month$mhw[j] <- mean(HH[1:(length(HH)-1)])
Ballycotton.Month$mlw[j] <- mean(LL)
Ballycotton.Month$mtl[j] <- mean(c(HH[1:(length(HH)-1)],LL))
Ballycotton.Month$n[j] <- length(LL)
cat("in ", Ballycotton.Month$year[j], "month = ", Ballycotton.Month$month[j],"\n")
cat("you now have ", length(HH)-1," high tides\n")
cat("you now have ", length(LL)," low tides\n")
continue = TRUE
} else if (regexpr(question2, 'l', ignore.case = TRUE) == 1){
Ballycotton.Month$mhw[j] <- mean(HH)
Ballycotton.Month$mlw[j] <- mean(LL[1:(length(LL)-1)])
Ballycotton.Month$mtl[j] <- mean(c(LL[1:(length(LL)-1)],HH))
Ballycotton.Month$n[j] <- length(LL)
cat("in ", dub.mon$year[j], "month = ", Ballycotton.Month$month[j],"\n")
cat("you now have ", length(HH)," high tides\n")
cat("you now have ", length(LL)-1," low tides\n")
continue = TRUE
}
else {Ballycotton.Month$mhw[j] <- NA
Ballycotton.Month$mlw[j] <- NA
Ballycotton.Month$mtl[j] <- NA
Ballycotton.Month$n[j] <- length(LL)}
}
}
## you are on index 1 of 88
## in 2010 month = 11
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 2 of 88
## in 2010 month = 12
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 3 of 88
## in 2011 month = 1
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 4 of 88
## in 2011 month = 2
## you have 54 high tides
## you have 54 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 5 of 88
## in 2011 month = 3
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 6 of 88
## in 2011 month = 4
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 7 of 88
## in 2011 month = 5
## you have 61 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 8 of 88
## in 2011 month = 6
## you have 59 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 9 of 88
## in 2011 month = 7
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 10 of 88
## in 2011 month = 8
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 11 of 88
## in 2011 month = 9
## you have 41 high tides
## you have 42 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 12 of 88
## in 2011 month = 10
## you have 4 high tides
## you have 4 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 13 of 88
## in 2012 month = 1
## you have 49 high tides
## you have 49 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 14 of 88
## in 2012 month = 2
## you have 56 high tides
## you have 56 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 15 of 88
## in 2012 month = 3
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 16 of 88
## in 2012 month = 4
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 17 of 88
## in 2012 month = 5
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 18 of 88
## in 2012 month = 6
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 19 of 88
## in 2012 month = 7
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 20 of 88
## in 2012 month = 8
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 21 of 88
## in 2012 month = 9
## you have 58 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 22 of 88
## in 2012 month = 10
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 23 of 88
## in 2012 month = 11
## you have 58 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 24 of 88
## in 2012 month = 12
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 25 of 88
## in 2013 month = 1
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 26 of 88
## in 2013 month = 2
## you have 54 high tides
## you have 54 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 27 of 88
## in 2013 month = 3
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 28 of 88
## in 2013 month = 4
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 29 of 88
## in 2013 month = 5
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 30 of 88
## in 2013 month = 6
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 31 of 88
## in 2013 month = 7
## you have 52 high tides
## you have 53 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 32 of 88
## in 2013 month = 11
## you have 20 high tides
## you have 20 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 33 of 88
## in 2013 month = 12
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 34 of 88
## in 2014 month = 1
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 35 of 88
## in 2014 month = 2
## you have 55 high tides
## you have 53 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 36 of 88
## in 2014 month = 3
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 37 of 88
## in 2014 month = 4
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 38 of 88
## in 2014 month = 5
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 39 of 88
## in 2014 month = 6
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 40 of 88
## in 2014 month = 7
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 41 of 88
## in 2014 month = 8
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 42 of 88
## in 2014 month = 9
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 43 of 88
## in 2014 month = 10
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 44 of 88
## in 2014 month = 11
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 45 of 88
## in 2014 month = 12
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 46 of 88
## in 2015 month = 1
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 47 of 88
## in 2015 month = 2
## you have 54 high tides
## you have 54 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 48 of 88
## in 2015 month = 3
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 49 of 88
## in 2015 month = 4
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 50 of 88
## in 2015 month = 5
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 51 of 88
## in 2015 month = 6
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 52 of 88
## in 2015 month = 7
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 53 of 88
## in 2015 month = 8
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 54 of 88
## in 2015 month = 9
## you have 58 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 55 of 88
## in 2015 month = 10
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 56 of 88
## in 2015 month = 11
## you have 58 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 57 of 88
## in 2015 month = 12
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 58 of 88
## in 2016 month = 1
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 59 of 88
## in 2016 month = 2
## you have 56 high tides
## you have 56 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 60 of 88
## in 2016 month = 3
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 61 of 88
## in 2016 month = 4
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 62 of 88
## in 2016 month = 5
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 63 of 88
## in 2016 month = 6
## you have 57 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 64 of 88
## in 2016 month = 7
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 65 of 88
## in 2016 month = 8
## you have 61 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 66 of 88
## in 2016 month = 9
## you have 58 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 67 of 88
## in 2016 month = 10
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 68 of 88
## in 2016 month = 11
## you have 58 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 69 of 88
## in 2016 month = 12
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 70 of 88
## in 2017 month = 1
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 71 of 88
## in 2017 month = 2
## you have 54 high tides
## you have 54 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 72 of 88
## in 2017 month = 3
## you have 51 high tides
## you have 52 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 73 of 88
## in 2017 month = 4
## you have 53 high tides
## you have 55 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 74 of 88
## in 2017 month = 5
## you have 60 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 75 of 88
## in 2017 month = 6
## you have 49 high tides
## you have 48 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 76 of 88
## in 2017 month = 7
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 77 of 88
## in 2017 month = 8
## you have 54 high tides
## you have 55 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 78 of 88
## in 2017 month = 9
## you have 57 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 79 of 88
## in 2017 month = 10
## you have 59 high tides
## you have 60 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 80 of 88
## in 2017 month = 11
## you have 57 high tides
## you have 57 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 81 of 88
## in 2017 month = 12
## you have 60 high tides
## you have 58 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 82 of 88
## in 2018 month = 1
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 83 of 88
## in 2018 month = 2
## you have 46 high tides
## you have 46 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 84 of 88
## in 2018 month = 3
## you have 60 high tides
## you have 59 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 85 of 88
## in 2018 month = 4
## you have 9 high tides
## you have 9 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 86 of 88
## in 2018 month = 11
## you have 13 high tides
## you have 13 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 87 of 88
## in 2018 month = 12
## you have 53 high tides
## you have 52 low tidesDo the numbers of high tides match low (Y/N)
## you are on index 88 of 88
## in 2019 month = 1
## you have 36 high tides
## you have 37 low tidesDo the numbers of high tides match low (Y/N)
Plot the difference between mean tide level and mean sea level:
plot(Ballycotton.Month$time,Ballycotton.Month$h-Ballycotton.Month$mtl,type="l")
What does the variable ‘n’ tell you?
plot(Ballycotton.Month$time,Ballycotton.Month$n)
Plot the difference between mean high and low tides:
plot(Ballycotton.Month$time[Ballycotton.Month$n>50],
Ballycotton.Month$h[Ballycotton.Month$n>50]-Ballycotton.Month$mtl[Ballycotton.Month$n>50],
type="l",ylab = "MSL - MTL [N>50]",xlab = "Year")
points(Ballycotton.Month$time,Ballycotton.Month$h-Ballycotton.Month$mtl,col="red")
highs and lows
plot(Ballycotton.Month$time,Ballycotton.Month$mhw,type="l",col="red",ylim=c(-2,2))
lines(Ballycotton.Month$time,Ballycotton.Month$mlw,type="l",col="green2")
lines(Ballycotton.Month$time,Ballycotton.Month$mtl,type="l",col="black")