LOADING AND PLOTTING THE DATA (Part 1)
Working with hydro-meteorological data can be very time consuming and exhausting. Luckily, R can provide a framework to easily import and process data in order to implement statistical analysis and models. In these tutorials, we are going to explore and analyze data from a tropical basin in order to create a simple forecast model.
Let’s have a look at these exercises and examples.
Answers to these exercises are available here.
First, let’s import the daily levels of a river and the rainfall data from the basin, stored in a CSV file. Please download the data here (PAICOL.csv) and import it with the function
Then, assign it to
river_data is a data frame, so we can access the attributes of it with
$; for example, you can get the date values with
To guarantee that the
DATE column has the proper format, it is crucial to convert the string values into dates with the function
as.Date. Please replace the value of
DATE with formatted dates.
Create a summary of the
Normally we can use the build in R functions; but, this time, we will use the
ggplot package. In my opinion, it is able to create better plots. Before we start, install it and load it to be able to use it.
Create a line plot of the
LEVEL with the
Create a scatter plot of the
Create a plot of the
Find and plot circles on the
LEVEL plot at the maximum and minimum value.
LEVEL for the year “2001.”