In this exercise set, we will explore basic analysis for time series hydrological data in
R . We will also introduce the
hydroTSM package; a useful package in hydrology.
Hydro TSM is specifically built by Mauricio Zambrano-Bigiarini (2014) for hydrology analysis, including the datasets visualization.
Hydrological time series data can be generated from automatic recording instruments and/or manual recording by a human. In this part, we will focus on analyzing precipitation data of the Saugeen River (download here (Hipel and McLeod (1994)). Basic precipitation data analysis includes extracting the statistics summary and monthly and annual precipitation analysis accompanied by data visualization. The core of this exercise can be applied to flow and temperature variables as well.
Answers to the exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Please install and load the package
hydroTSM before starting the exercise.
Read the precipitation dataset (.csv) file. Name it
Data screening and wrangling, including:
a. Do not delete significant meaning rows.
b. Changing column names into memorable ones.
Checking and converting data type, including:
a. Change the value of precipitation into numerals.
b. Change the data type into
zoo object. Name it as
c. Subset data from 1988-01-01 to 1990-12-31.
Extract the statistics summary of
Find the total year of observations.
Find the average annual precipitation.
Extract the total monthly precipitation analysis using
daily2monthly function. Name it as
Create a total monthly precipitation boxplot.
Create a total monthly precipitation visualization using the matrixplot function.
a. Create a matrix of
b. Re-name the matrix column as the 12 months and the matrix row as a unique time of
c. Load the
d. Print the matrix using
Create a set of daily and monthly visualizations, including time series, boxplot, and histogram in one display using the
hydroplot function. Play with
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below