browseURL("http://nrfa.ceh.ac.uk/data/station/meanflow/39072")
qfile <- system.file("extdata/discharge39072.csv", package="berryFunctions")
Q <- read.table(qfile, skip=19, header=TRUE, sep=",", fill=TRUE)[,1:2]
rm(qfile)
colnames(Q) <- c("date","discharge")
Q$date <- as.Date(Q$date)
Q$discharge[450:581] <- NA
plot(Q, type="l")
seas <- seasonality(date, discharge, data=Q, shift=100, main="NRFA: Thames\nRoyal Windsor Park")
head(seas)
# notice how n for nonmissing values is lower in one single hydrological year,
# which includes parts of two consecutive calendarical years.
seas <- seasonality(date, discharge, data=Q, plot=2) # most floods in winter
seas <- seasonality(date, discharge, data=Q, plot=3)
seas <- seasonality(date, discharge, data=Q, plot=3, shift=100)
seasonality(date, discharge, data=Q[200:300,], plot=3, nmax=1)
seasonality(date, discharge, data=Q[100:200,], plot=3, nmax=1, shift=100)
## Not run:
# dev.new(noRStudioGD=TRUE, record=TRUE) # large graph on 2nd monitor
# par(mfrow=c(2,2))
# seas <- seasonality(date, discharge, data=Q, plot=1:4, shift=100)
# seas <- seasonality(date, discharge, data=Q, plot=1:4, lwd=2)
# seas <- seasonality(date, discharge, data=Q, plot=1:4, nmax=1, shift=100)
# seas <- seasonality(date, discharge, data=Q, plot=1:4, col=divPal(100, ryb=TRUE))
# ## End(Not run)
Run the code above in your browser using DataLab