Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Hydrol. Earth Syst. Sci.

, 23, 2939–2963, 2019


https://doi.org/10.5194/hess-23-2939-2019
© Author(s) 2019. This work is distributed under
the Creative Commons Attribution 4.0 License.

Using R in hydrology: a review of recent developments


and future directions
Louise J. Slater1 , Guillaume Thirel2 , Shaun Harrigan3 , Olivier Delaigue2 , Alexander Hurley4 , Abdou Khouakhi5 ,
Ilaria Prosdocimi6 , Claudia Vitolo3 , and Katie Smith7
1 School of Geography and the Environment, University of Oxford, Oxford, OX1 3QY, UK
2 HYCAR Research Unit, IRSTEA, 1 Rue Pierre-Gilles de Gennes, 92160 Antony, France
3 Forecast Department, European Centre for Medium-Range Weather Forecasts (ECMWF),

Shinfield Park, Reading, RG2 9AX, UK


4 School of Geography, Earth and Environmental Sciences, University of Birmingham, Birmingham, B15 2TT, UK
5 School of Architecture, Building and Civil Engineering, Loughborough University, Loughborough, LE11 3TU, UK
6 Department of Environmental Sciences, Informatics and Statistics, Ca’ Foscari University of Venice, 30172 Venice, Italy
7 Centre for Ecology & Hydrology, Maclean Building, Crowmarsh Gifford, Wallingford, OX10 8BB, UK

Correspondence: Louise J. Slater ([email protected])

Received: 31 January 2019 – Discussion started: 18 February 2019


Revised: 4 June 2019 – Accepted: 14 June 2019 – Published: 12 July 2019

Abstract. The open-source programming language R has ences, application programming interfaces (APIs) providing
gained a central place in the hydrological sciences over new avenues for data acquisition and provision, enhanced
the last decade, driven by the availability of diverse hydro- teaching of hydrology in R, and the continued growth of the
meteorological data archives and the development of open- community via short courses and events.
source computational tools. The growth of R’s usage in hy-
drology is reflected in the number of newly published hy-
drological packages, the strengthening of online user com-
munities, and the popularity of training courses and events. 1 Introduction: the rapid rise of R in hydrology
In this paper, we explore the benefits and advantages of
R’s usage in hydrology, such as the democratization of data In recent decades, the hydrological sciences, like many other
science and numerical literacy, the enhancement of repro- disciplines, have witnessed major changes due to the growth
ducible research and open science, the access to statistical of diverse data archives and the development of computa-
tools, the ease of connecting R to and from other languages, tional resources. Hydrology has benefited from the increase
and the support provided by a growing community. This pa- in publicly accessible data, including (a) observational river
per provides an overview of a typical hydrological work- flow archives (Hannah et al., 2011) such as the World Mete-
flow based on reproducible principles and packages for re- orological Organization’s Global Runoff Data Centre, which
trieval of hydro-meteorological data, spatial analysis, hydro- currently includes more than 9500 stations from 161 coun-
logical modelling, statistics, and the design of static and dy- tries, (b) gridded reanalysis climate data products such as
namic visualizations and documents. We discuss some of the Copernicus’s ERA-Interim (Dee et al., 2011) or ERA5 (Hers-
challenges that arise when using R in hydrology and use- bach et al., 2018; Copernicus Climate Change Service,
ful tools to overcome them, including the use of hydrologi- 2018), (c) measurements from sensors and satellites, such as
cal libraries, documentation, and vignettes (long-form guides total water storage variations from the Gravity Recovery and
that illustrate how to use packages); the role of integrated de- Climate Experiment (GRACE; Tapley et al., 2004) or snow
velopment environments (IDEs); and the challenges of big cover area from NSIDC MODIS (Hall and Riggs, 2016), and
data and parallel computing in hydrology. Lastly, this paper (d) catchment attributes such as the Global Streamflow In-
provides a roadmap for R’s future within hydrology, with dices and Metadata Archive (Do et al., 2018) or national
R packages as a driver of progress in the hydrological sci- datasets such as GAGES-II (Falcone, 2011) and CAMELS

Published by Copernicus Publications on behalf of the European Geosciences Union.


2940 L. J. Slater et al.: R in Hydrology

(Addor et al., 2017). Together, these datasets have facilitated satile and has a wide range of uses, including data acqui-
the investigation of many catchments as well as interdisci- sition and provisioning, manipulation, analysis, modelling,
plinary research linking meteorology, climatology, hydrol- statistics, visualization, and even well-developed geospatial
ogy, and the earth sciences. and geographic information system (GIS) applications. R
In addition to the availability of large-scale data archives, can be used for generating reports, making interactive pre-
the increase in computational power and uptake of program- sentations for teaching or conferences, or even prototyp-
ming languages have also been a major driver of change in ing dashboards and web applications. One of the greatest
the discipline. Increasingly, hydrologists are using data sci- strengths of R is its extremely active community of users,
ence approaches to derive process insights from large and who, in the past 25 years, have developed and released in the
complex datasets (e.g. Guo, 2017). The ability to explore and public domain more than 14 000 packages spanning many
mine these datasets has facilitated a move from in-depth ex- scientific disciplines. The Comprehensive R Archive Net-
periments in single catchments towards large-sample studies work (CRAN; https://cran.r-project.org) is the main repos-
(e.g. Villarini et al., 2009; Berghuijs et al., 2014; Slater et al., itory for these packages, hosted by a network of FTP and
2015; Archfield et al., 2016; Blöschl et al., 2017; Blum et al., web servers around the world. The abrupt increase in the
2017; Harrigan et al., 2018). By applying an analysis to many number of hydrological package updates in 2018–2019 ex-
catchments, or grouping those with similar characteristics, emplifies the growing importance of the language in hydrol-
hydrologists have been able to test the broad applicability ogy and strengthening of the community (Fig. 1). These de-
of hydrological theories and draw systematic insights about velopments have allowed the R language to fit comfortably
hydrological processes (e.g. Blöschl et al., 2013). Large- in production-ready ecosystems (e.g. web applications) and
sample studies are increasingly being employed to develop take advantage of cutting-edge technologies and tools for im-
novel (conceptual and/or physical) models that are applica- proving reproducibility, testing, and continuous integration.
ble across diverse catchment conditions, thereby improving This paper aims to provide a broad overview of the utility
process understanding and leading to more robust predictions of R in the hydrological sciences and of important develop-
(e.g. Gupta et al., 2014). At the same time, a broad range ments in recent years. In Sect. 2 we provide a summary of
of well-established lumped (e.g. GR4J; Perrin et al., 2003) the many benefits and advantages of using R in hydrology. In
and semi-distributed (e.g. TOPMODEL, Beven, 1997) mod- Sect. 3 we describe some of the key hydrological packages
els of the hydrological cycle – many of which were initially that have been developed by the community as well as gen-
developed in older languages such as Fortran – have now eral packages of broad application in the sciences. In Sect. 4
been incorporated into R packages. Some of them have been we discuss some of the challenges that the hydrologic R users
translated into R, and others remain in their initial languages, (R-Hydro) community faces, including tools and solutions to
e.g. SWAT (Neistsch et al., 2005). The uptake of empirical, overcome these challenges. Finally, in Sect. 5 we list some of
conceptual, and physically based computational hydrologi- the future directions to strengthen the computational hydrol-
cal models as well as the growth of large-sample studies ogy community.
have driven the emergence of a field that can be described
as computational hydrology (e.g. Hutton et al., 2016; Melsen
et al., 2017): a scientific paradigm that allows hydrologists 2 The benefits and advantages of using R in hydrology
to explore hydrological questions with a computational ap-
proach. Computational hydrology aims to develop repro- 2.1 Democratizing open science and numerical literacy
ducible hydrological analyses that can be applied to many
catchments, with the aim of generating novel and system- One of the principal advantages of R is its ease of use, result-
atic process insights that improve our physical understanding ing from typically detailed documentation, a large number
of the hydrological cycle. The field differs somewhat from of online resources, object-oriented programming (the lan-
both hydroinformatics (e.g. Abbott et al., 1991), which has a guage is organized around objects with unique attributes),
greater focus on information and communication technolo- functional programming (the code can be written with func-
gies and/or black-box approaches to address water-related tions to facilitate modularity and avoid changing-state data),
issues, and geocomputation, (e.g. Openshaw and Abrahart, and the availability of the source code under the open-source
2000; Lovelace et al., 2019), which uses similar computa- license. Further, R can be run on all major operating sys-
tional techniques for spatial data analysis. tems (i.e. Microsoft Windows, macOS, and Linux), making
The growth of computational hydrology has been en- it ideal for institutional or personal use. In contrast with com-
hanced by the development of the open-source program- piled languages, such as C or Fortran, R is an interpreted
ming language R, originally developed for statistical com- language, which means that the code can be written and ex-
puting by Ross Ihaka and Robert Gentleman in the 1990s ecuted line by line. In practice this means that achieving a
(Ihaka and Gentleman, 1996; R Core Team, 2018) and sup- basic hydrological analysis can be as simple as writing a se-
ported by an enthusiastic and rapidly growing online com- quence of commands for reading a file, cleaning the data, and
munity. As a free multiplatform language, R is highly ver- plotting a graph. These sequences of commands are typically

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2941

Figure 1. The number of R packages available on CRAN (1997–2019). All packages are shown in (a), and hydrology packages only (defined
as those that include the string “hydro” within the package metadata; erroneous packages containing terms like hydrocarbon were removed)
are shown in (b). Bar colours indicate number of packages published based on (1) date of first release (grey bars; https://cran.r-project.org/
src/contrib/Archive/) and (2) date of last publication – i.e. most recent publication date of packages that are currently available on CRAN
(black bars; https://cran.r-project.org/web/packages/available_packages_by_date.html). In both cases each package is counted only once; for
example the package hydroTSM was first released in 2010 (grey), but its most recent update was in 2017 (black). The script to produce this
figure is provided in the Supplement. Data were downloaded from CRAN on 23 June 2019; thus the year 2019 is incomplete.

collated in an R Script; together, multiple scripts may con- computing skills to researchers since 1998, and R now forms
stitute a hydrological workflow (see Fig. 3). A high level of a central part of their training. Over the past decade or so,
documentation and support exists for each of the tasks within R has become one of the core tools for scientific compu-
a hydrological workflow, including a diverse range of pack- tation in hydrology. Hosted instances of R allow the user
ages (see Sect. 3). R users may search for R-relevant con- to run R and RStudio® (an integrated development environ-
tent (such as expressions, packages, and functions) using the ment – IDE; described in greater detail in Sect. 4.2) in the
dedicated Internet search engine, RSeek (https://rseek.org), cloud, i.e. in a web browser rather than locally on one’s own
as well as generalist search engines. For many R newcomers, computer. These hosted instances have made the language
the initial hurdle is finding the time required to gain a basic more accessible to non-specialists due to the large range
understanding of R itself; but these efforts pay off rapidly as of pre-installed packages. Importantly, the RStudio Cloud
one learns how to find solutions on the Internet (see Sect. 2.5) (https://rstudio.cloud/) has recently been developed to make
and to navigate help files provided within R. it easy for professionals, hobbyists, trainers, teachers, and
One of the advantages of writing a script is that it can students to do, share, teach, and learn data science using R
be reused and improved incrementally over time so that the and provides many learning materials, including interactive
author never has to repeat a task manually (in contrast to tutorials covering the basics of data science, cheat sheets for
point-and-click software that lacks a programmatic inter- working with popular R packages, and a guide to using RStu-
face). Moreover, the same script can be reused repeatedly by dio Cloud. Such hosted instances of R remove the initial hur-
different people to reproduce a given result (avoiding dupli- dle of installing R and the required packages (i.e. the techni-
cation of efforts) or to analyse different data, e.g. different calities) and ultimately make scientific work more accessible.
catchments, different types of gridded data, or the same data The R-Hydro community has developed a number of plat-
at different points in time. Thus, scripts written in R (or other forms to share computational hydrology analyses, and code
languages) have wide-ranging benefits, as they facilitate the is increasingly being shared via repositories (see Sect. 5.1).
testing and quality control of the scientific workflow, can be Code and results can be published as traditional media (e.g.
shared and improved by a team of users, lessen the risk of as articles, supplemental material, scripts, packages, or com-
making manual mistakes, and significantly enhance the speed putational environments) or on the web via blog posts, snip-
with which analyses can be conducted and updated. pets, or tutorial documents, allowing users to engage inter-
Recent developments in R have contributed to enhancing actively. The “literate programming” paradigm (i.e. inter-
open science and numerical literacy in the hydrological sci- spersing snippets of code and written text within a unique
ences. R’s ease of access and use has improved what might document; see Knuth, 1984) has also become increasingly
be termed “scientific computing literacy” within the hydro- popular due to the development of dashboards and online
logical community. Volunteer projects such as the Software publishing platforms. Dashboards are interfaces that may in-
Carpentry (Wilson, 2006, 2014) have been teaching basic clude a group of related data visualizations such as charts,

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2942 L. J. Slater et al.: R in Hydrology

Figure 2. The EGU short course Using R in Hydrology, 11 April 2018.

Figure 3. A typical hydrological workflow in R, containing eight steps. A selection of relevant R packages used within each script is indicated
in coloured text; these packages are described in further detail in Sect. 3.1 to Sect. 3.8.

graphs, tables, and maps (e.g. Fig. 6). They can be fixed reproduce and verify previous findings. Encouraging repro-
(e.g. a non-interactive web page) or dynamic (e.g. allow- ducible practices helps reduce the likelihood of errors (meth-
ing users to alter input values and see how outputs change ods can be tested by other researchers) while increasing the
virtually in real time). Hydrologists have increasingly em- uptake of any positive developments within a discipline (Hut-
ployed dashboards to display their analyses in an interac- ton et al., 2016). However, scientific research is increasingly
tive, user-friendly manner, using packages such as plotly, under fire for its lack of reproducibility due to an inadequate
a graphing library that makes publication-quality graphs methodology description (Ceola et al., 2015) and model and
online (Sievert, 2018), the shiny web application frame- data availability. True reproducibility requires more than the
work (Chang et al., 2015), shinydashboard (Chang and mere repeatability of results with the same computer code
Borges Ribeiro, 2018), or the flexdashboard package and data: one must also be able to reproduce a study’s con-
(Iannone et al., 2018). Additionally, free services such as clusions when testing the theory with different data or a dif-
RPubs (a free web-publishing platform; https://rpubs.com) ferent model set-up (Melsen et al., 2017).
and the aforementioned plotly enable the publishing of The open-source nature of R packages and the CRAN
these static or interactive documents and visualizations on- repository set-up are one key added value of R to repro-
line. In doing so, these publishing services facilitate immedi- ducible geoscientific research (Pebesma et al., 2012). The
ate interaction and knowledge transfer. CRAN repository ensures the traceability of past analy-
ses by archiving former versions of the packages com-
2.2 Enhancing reproducible hydrological research and piled on any platform (https://cran.r-project.org). In addi-
open science tion, packages are citeable in reports and papers together
with their version number, allowing the user to track which
Reproducibility is a key feature of the scientific method and code was used. The package developers are also “trace-
can be broadly defined as the ability for the community to

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2943

Figure 4. An example of a figure in a paper produced in R with the package ggplot2 using the facet_grid function, which allows the
user to split a dataset by categories (rows and columns). Here, a probabilistic time-series GAMLSS model of flood frequency at one gauging
station in Ohio, USA, is shown for four different seasons (rows) and two peak-over-threshold quantities (columns: two to four peaks per
year). The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon), and the observed values are plotted in the
foreground as grey circles (geom_point). Source: Neri et al. (2019).

able” on the CRAN via their ORCID (Open Research and nal of Water Resources Planning and Management and Jour-
Contributor ID) number, which provides an indication of nal of Hydrologic Engineering now actively encourage au-
whether they also authored any corresponding scientific pa- thors to publish the data and computer codes underlying the
pers. The CRAN Task Views provide guides to the pack- results presented in their papers. The journal Nature states
ages and tools that exist on CRAN for the different dis- that a manuscript can be rejected if the code used to generate
ciplines. Note that many packages are submitted to online new analyses cannot be provided to the editors and review-
repositories such as GitHub that never make it to CRAN ers. Despite the advantages of sharing hydrological code, few
for a range of reasons, but this does not necessarily make computational hydrologists do this because cleaning and an-
them less reliable. The Task Views provide a list of tools notating the code places an additional burden on the pub-
which can enhance reproducibility in R (see https://cran. lishing time frame. However, it is reasonable to assume that
r-project.org/web/views/ReproducibleResearch.html). Rely- as more journals require submission of codes with papers,
ing on well-established publishing platforms such as CRAN the community of computational hydrologists (and associ-
and GitHub has promoted the use of best practice in writ- ated fields) will continue to grow and strengthen the field. In
ing R code. Packages such as rhub (Csárdi, 2017) pro- addition to the sharing of open-source code, reproducibility
vide code checks for packages on certain operating systems, experts also advocate the use of software tool sets such as
while roxygen2 helps users create documentation for their version control, scripting, container technology, and compu-
R packages (Wickham et al., 2018a). Other initiatives, such tational notebooks to enhance the reproducibility of scien-
as rOpenSci (carefully vetted scientific R software tools; see tific results (Perkel, 2018). Hydrological tutorials, vignettes,
https://ropensci.org) and their code peer review, have facili- or teaching documents increasingly implement literate pro-
tated the implementation of best practice whilst holding au- gramming (Sect. 2.1), where the code and results are de-
thors to scientific scrutiny. scribed in plain English within the same document or web
Journals in the field of hydrology such as Hydrology and page.
Earth System Sciences, Water Resources Research, and the In the hydrological sciences, several ongoing open scien-
American Society of Civil Engineers (ASCE) journals Jour- tific initiatives can be noted other than the R packages that

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2944 L. J. Slater et al.: R in Hydrology

Figure 5. Use-case scenario for implementation of APIs developed within hydrological sciences. Group A collates the most recent earth-
and ground-based observations of land cover, topography, and climate data for an in-house project yet allows an API to interact with an
analysis-ready, spatially explicit dataset for their region of interest. Group B is interested in geomorphological processes and has developed
a model to predict likely occurrence of mass movements, which they also provide access to via an API. During a period of extreme rainfall
over a scientifically unrelated region, both groups decide to adjust their methods and API to provide pertinent data (group A), which feed into
predictions of landslide risk (group B). Finally, a disaster relief organization (group C) can swiftly act and use the outputs from the adapted
API (A + B) to develop a simple web application with maps and warnings for use by the general public in the affected area.

are discussed in Sect. 3. These initiatives include the Hy- flow, the question and answer website for programmers, on
droShare web-based system for sharing hydrologic data and 18 May 2019 generated 12 339 results with the tag “R”,
models, which allows hydrologists to visualize, analyse, and 9582 results with Python, 4916 with Java, 2623 with C#,
work with data and models on the HydroShare website (e.g. and 48 with Fortran. R is GNU S, a language which can
creating and publishing a web app resource; Essawy et al., be described as the modern implementation of the S lan-
2018). Additionally, the Sharing Water-related Information guage (Becker and Chambers, 1984; Chambers, 1998), and
to Tackle Changes in the Hydrosphere for Operational Needs is specifically optimized for statistical computing. In addi-
(SWITCH-ON) virtual laboratory aims to explore the poten- tion to the standard statistical techniques within base-R (i.e.
tial of open data for water security and management (Ceola the inbuilt basic functions that define R as a language), R
et al., 2015). The reproducibility agenda has benefited from also provides access to a large variety of advanced and re-
strong political and financial support, with European Union cent statistical packages, which have been developed by its
projects like FOSTER Plus (Fostering the practical imple- user community of statisticians and statistically minded sci-
mentation of Open Science in Horizon 2020 and beyond) that entists working in a range of research fields. When compar-
aim to encourage open science. The European Commission’s ing R with other similar open-source languages, users often
Science with and for Society programme, implemented as describe R’s unique selling point as the vast number of sta-
part of Horizon 2020 (European Commission, 2015, p. 17), tistical packages which liken it to a free, community-driven
similarly noted that the reuse of research data generated with statistical software.
public funding should have beneficial impacts for science, The statistical and graphical packages provided in R are
the economy, and society. As such, open science is expected particularly useful for the hydrological sciences and include
to encourage interdisciplinary research and is considered a techniques such as linear and non-linear modelling, statisti-
key approach to tackle the grand challenges of our time. cal tests, time-series analysis, classification, or clustering. A
description of specific statistical packages relevant to hydrol-
2.3 Providing statistical tools for hydrology ogy is provided in Sect. 3.6.

There are many different types of software for statistical 2.4 Connecting R to and from other languages
analysis, but R is still considered the most powerful and pop-
ular language and environment for statistical computing. For Many different programming languages are used in hydrol-
example, a search for the word “statistics” on Stack Over- ogy, including older languages such as Fortran, developed in

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2945

Figure 6. The airGRteaching interface that is used for teaching hydrological modelling. Students can choose a catchment dataset and a
hydrological model and activate a snow model on the top left panel of the interface. Modifying the parameters values (on the left) by using
the sliding bars will automatically update the graphs and scores displayed (on the right). This interface highlights in an interactive manner the
basic principle of the rainfall–runoff relationship and its description in hydrological models. At the bottom left of the interface, an objective
function can be chosen and an automatic calibration procedure can be launched within the interface.

the 1950s (e.g. Backus, 1978), and C in 1972 (e.g. Ritchie, Bellosta, 2012), and XRPython (Chambers, 2017). Addi-
1993); proprietary commercial languages, e.g. MATLAB® , tionally, R can also be connected to JavaScript (e.g. pack-
initially released in 1984 (MathWorks, 2018); and more re- age V8; Ooms, 2017), MATLAB (e.g. package R.matlab;
cent open-source languages like Python, which appeared in Bengtsson, 2018), or Julia (packages JuliaCall and
1990 (e.g. Sanner et al., 1999; Guttag, 2013), R in 1993 (e.g. XRJulia; Chambers, 2018; Li, 2018). Conversely, connect-
R Core Team, 2018; Ihaka, 1998), and Julia in 2012 (Bezan- ing other languages to R is also possible. For example, rpy2
son et al., 2012). (Gautier, 2018) is the Python interface to the R language and
S and R were both built using algorithms implemented runs an embedded R, providing access from Python using R’s
mostly in Fortran and sometimes in C (Chambers, 2016, own C application programming interface (API). The Python
p. 55), which is why R can be connected natively to both library pyRserve (Heinkel, 2017) also connects Python
languages. Interconnections between R and other languages with R using Rserve (a TCP/IP server which allows other
can be very useful for taking advantage of each language’s programs to use facilities of R). The RCall package allows
strengths or using pre-existing scripts that were originally users to call R from Julia (Bates et al., 2015).
written in other languages. For example, C and Fortran are
both efficient in performing loop tasks. This is the reason 2.5 Interacting with the R-Hydro community: scientific
why the apply function loops are coded in C. The airGR hy- resources and courses
drological models (Coron et al., 2017, 2018) also make use
of Fortran in order to take advantage of its CPU efficiency. One of the major advantages of R is the extensive user
R can also be connected to different languages using community, which provides ample support to newcomers
a range of packages, e.g. C++ (package Rcpp; Eddel- through various initiatives and is growing at a fast pace.
buettel and Balamuta, 2017) and Java (package rJava; R-Hydro beginners are strongly encouraged to join the
Urbanek, 2018). Connections to Python can be achieved discussion on various R-related topics on social media.
with the packages reticulate (Allaire et al., 2018b), On Twitter, the “#rstats” community is particularly active,
rPython (Bellosta, 2015), rJython (Grothendieck and and users are exposed to communication about a range
of new packages and recent developments. Stack Overflow

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2946 L. J. Slater et al.: R in Hydrology

(https://stackoverflow.com) is the go-to online discussion fo- governance and foundation model that supports the world-
rum for any user, from beginners to expert developers, and wide community of users, maintainers, and developers of R
provides code snippets to solve a wide range of common software. The R Consortium provides support to the com-
problems. In addition, the R Project also offers thematic munity in multiple ways. One example of such support is
mailing lists (https://www.r-project.org/mail.html), relating the grant programme run by the R Consortium’s Infrastruc-
to usage (R-help), package development (R-package-devel), ture Steering Committee (ISC), which funds development of
and language development (R-devel), in order to help oth- projects seeking to promote improvement of the R infrastruc-
ers, report bugs, or propose solutions. More recent but al- ture and to achieve long-term stability of the R community.
ready extremely active is the RStudio Community forum
(https://community.rstudio.com), which includes users inter-
ested in RStudio-developed applications and packages.
A wide range of scientific resources, including online 3 R packages in a typical hydrological workflow
manuals and tutorials in several languages, have been de-
veloped by the community. The rOpenSci project (https: R is an ever-growing environment, as can be seen in the num-
//ropensci.org) brings together a community of volunteers ber of R packages that are developed every year (Fig. 1).
who promote the open development of packages in a non- There are now hydrological packages for every step of a
profit initiative by reviewing scientific R packages before standard hydrological workflow (Fig. 3); we describe each
they are uploaded to CRAN. rOpenSci has contributed no- of these steps in subsequent sections.
tably to the development of best practice through free code
reviews and targeted or invited blog posts. Resources can be 3.1 Setting up a repository and finding the right
found in many places online, such as the Journal of Open packages
Source Software (JOSS), which hosts a wealth of short pa-
pers documenting R packages. Setting up a repository with version control (i.e. a review-
Short courses, i.e. voluntary training sessions for R users able and restorable history) at the start of a research project
run during conferences like the European Geosciences Union has many advantages. A repository is a structured set of files
(EGU) General Assembly, have also grown in popularity in that will track edits any team member makes to the project,
the hydrological community in recent years (Fig. 2). Since similar to the track-changes function in common word pro-
the 2017 EGU General Assembly, the Using R in Hydrol- cessors. In R, version control can be implemented quite sim-
ogy short course has been organized in conjunction with ply by connecting RStudio with Git or Subversion through
the Young Hydrologic Society (YHS; https://younghs.com) hosting services like Bitbucket, GitHub, GitLab (which are
as part of the annual Hydrological Sciences division pro- like Dropbox for code). There are just a few initial steps
gramme. The core aim of the short course is to bring to- to set up a repository. These include (1) creating a local
gether the R-Hydro community, including both users who directory (folder) to host your (RStudio) project, (2) creat-
are learning to program and advanced users who are either ing a Git or a Subversion repository online, and (3) link-
teaching computational hydrology or developing packages ing the two. Beyond those three steps, all the user needs to
for hydrological analysis. Recent advances in R for hydrol- do is regularly commit (i.e. save) their code together with
ogy applications are demonstrated during the short course, a very brief summary of the changes made. These changes
and a platform for open discussion between guest speak- can then be uploaded, updating and synchronizing the online
ers and course participants is provided. By rotating topics repository with labelled annotations (username and times-
each year, a valuable repository of slides, code examples, and tamp). The repository can be public or private, with differ-
follow-up material is provided to the community on GitHub ent levels of administrator access for users. Many tutorials
(https://github.com/hydrosoc; see Sect. 5.6 for further infor- on how to set up a repository in R can be found online.
mation). It is also worth noting that a regular short course One example is the Software Carpentry course on R for Re-
is also run at the EGU on R package development. In addi- producible Scientific Analysis (https://swcarpentry.github.io/
tion to the EGU, other regular conferences and meetings such r-novice-gapminder/), which also provides valuable sugges-
as those run by the International Association of Hydrologi- tions on how to structure a project repository (e.g. with read-
cal Sciences (IAHS) and the Prediction in Ungauged Basins only source data, disposable generated data, and folders such
(PUB; PUB Summer School) also organize R courses during as “scr” for scripts and “doc” for documentation).
their meetings. The IAHS Statistical Hydrology (STAHY) Once a project folder or repository has been set up, one
commission regularly organizes workshops and short courses might need to identify the most useful R packages and func-
on various statistical topics, which typically come with a tions for the task at hand. CRAN Task Views were recently
computer-based component in R. developed to provide thematic lists of the packages that are
Finally, it is worth mentioning that the continued growth most relevant to specific disciplines. The Hydrology Task
of the R community is supported by the R Consortium (https: View for “Hydrological Data and Modelling” (https://cran.
//www.r-consortium.org/about), a group with an open-source r-project.org/web/views/Hydrology.html) was published to

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack- Additionally, many data retrieval packages that are rele-
ages under the following categories: vant to hydrological analyses have been developed by related
scientific disciplines, such as meteorology and climatology.
– Data retrieval. This includes hydrological data sources
In the future it seems likely that most water and meteoro-
(surface or groundwater, both quantity and quality) and
logical agencies around the world will facilitate access to
meteorological data (e.g. precipitation, radiation, and
these data via APIs and open-source packages (see Sect. 5.4
temperature, both measurements and reanalysis).
for further information on APIs and the possible future of
– Data analysis. This includes data tidying (e.g. gap fill- hydro-meteorological data provision). Table 1 is far from ex-
ing, data organization, and quality control), hydrograph haustive, and there are many other relevant packages that are
analysis (functions for working with streamflow data, available on CRAN. For example, the new ecmwfr package
including flow statistics, trends, and biological indices), provides a straightforward interface to the public ECMWF
meteorology (functions for working with meteorologi- Web API Services and the Copernicus Climate Data Store
cal and climate data), and spatial data processing. (CDS), where open datasets such as the ERA5 reanalysis are
openly available (Hufkens, 2018).
– Modelling. This includes process-based modelling
(scripts for preparing inputs and outputs and run- 3.3 Packages for reading, manipulating, and cleaning
ning process-based models) and statistical modelling the data
(hydrology-related statistical models).
Once data have been retrieved or downloaded, a broad range
Additionally, many of the other 38 Task Views that were of packages are available for reading different types of data
available in January 2019 were relevant to hydrology (https: and their associated metadata. However, these packages are
//cran.r-project.org/web/views). For example, the Environ- not specifically hydrological and so will be discussed here
metrics Task View contains a Hydrology and Oceanography with brevity. Note that in many cases, for example with the
section, and the High-Performance and Parallel Computing dataRetrieval package, the data are imported directly
with R Task View can also be useful for hydrologists us- into the R workspace. Basic data formats such as csv and
ing large amounts of data. Other relevant Task Views cover a txt can be read with base-R (read.table function) or with ad-
range of topics such as time-series analysis, machine learn- ditional packages that form part of the tidyverse pack-
ing, or spatial analysis. age suite (Wickham, 2017), which facilitate reading a range
One last way of discovering relevant and useful hydrolog- of formats including XLS(x), TSV, and FWF (e.g. package
ical packages is social media, such as Twitter, where many readr; Wickham et al., 2018b). The rio package facili-
hydrologists share their most recent publications as well as tates data import and export by making assumptions about
links to useful resources and packages. Some of the Twitter data structure from the file extension (Chan et al., 2018).
handles that highlight relevant packages for computational For reading or writing netCDF files, a number of pack-
hydrology include the USGS group supporting R scientific ages like ncdf4 (Pierce, 2017), easyNCDF (BSC-CNS and
programming (https://twitter.com/USGS_R) or the rOpenSci Manubens, 2017), stars (Pebesma, 2018b), or raster
page (https://twitter.com/ropensci). (Hijmans, 2017) can be used. GRIB files can also be handled
with packages such as raster or gribr (Wendt, 2018).
3.2 Packages for retrieving hydro-meteorological data
There is still relatively minimal support for Open Geospatial
One of the most useful computational advances in recent Consortium (OGC) services in R, although there are some
years has been the development of packages designed specif- packages such as sos4R (of which a new version is expected
ically to retrieve data from online hydrological archives. Dif- to be released on CRAN soon), ows4R (Blondel, 2018b), or
ferent packages have been designed for importing hydro- geometa (Blondel, 2018a).
metric data from repositories such as dataRetrieval Observed hydro-climatological time-series data typically
for the US Geological Survey (USGS) National Water In- need to be “cleaned” because they suffer from various data
formation System (Hirsch and De Cicco, 2015) or rnrfa gaps and errors. For an overview of the different issues with
for the UK’s National River Flow Archive (Vitolo et al., hydrological data, see Wilby et al. (2017). This step may in-
2016a). Many of these packages provide vignettes that il- volve handling missing data, checking data completeness, re-
lustrate how to use the functions. For example, the USGS’s shaping and aggregating data, or converting strings to date
waterData package allows the user to import USGS daily format. We do not develop this section specifically because
hydrological data from the USGS web services, plot time- these are general tasks in R. However, for overviews and tu-
series data, fill in missing values, or visualize anomalies over torials on manipulating and cleaning hydrological data, we
a range of timescales (e.g. 1 year, 30 d, or 1 d) in just a few point the reader to published resources from the Using R in
lines of code (see the waterData package vignette on the Hydrology workshop (see Sect. 5.6).
CRAN; Ryberg and Vecchia, 2017). Other relevant packages
are listed in Table 1.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2948 L. J. Slater et al.: R in Hydrology

Table 1. Examples of packages for hydrological and/or meteorological data retrieval. See the Hydrology Task View for latest additions
(https://cran.r-project.org/web/views/Hydrology.html).

Package Description
Hydrological data
dataRetrieval Retrieve USGS and EPA hydrologic and water quality data (Hirsch and De Cicco, 2015)
hddtools Hydrological data discovery tools (Vitolo, 2017)
hydroscoper Interface to the Greek national data bank for hydrometeorological information (Vantas, 2018)
rnrfa Retrieve, filter, and visualize data from the UK National River Flow Archive (Vitolo et al., 2016a)
tidyhydat Extract and tidy Canadian hydrometric data (Albers, 2017)
waterData Retrieve, analyse, and calculate anomalies of daily hydrologic time-series data (Ryberg and Vecchia, 2017)
Climatological data
daymetr Interface to the Daymet web services: NASA daily surface weather and climatological summaries over
North America, Hawaii, and Puerto Rico (Hufkens et al., 2018)
ecmwfr Interface to the public ECMWF API web services (Hufkens, 2018)
getMet Get meteorological data for hydrologic models (Sommerlot et al., 2016)
prism Access the Oregon State PRISM climate data using the web service API data (Hart and Bell, 2015)
rnoaa Interface to NOAA weather data (Chamberlain, 2019)

3.4 Packages for extracting driving data, spatial an interface to the Geometry Engine Open Source (GEOS)
analysis, and cartography library for geometrical operations, or package sf (Pebesma,
2018a), which provides support for simple features to encode
spatial vector data. Version 3.0 of ggplot2 offers support
In the past, R may have been a less powerful alternative to
for visualizing sf objects directly with a specific geometric
the more established spatial software for processing large
object (geom_sf), which allows users to visualize spatial data
datasets and extracting information. Now, however, R can be
(raster and shape files) easily. There is also a range of pack-
parallelized more easily than other software (harnessing the
ages for handling raster data, like raster (Hijmans, 2017),
power of multiple processor cores to handle large datasets)
which can be used to read, write, manipulate, analyse, and
and can integrate GIS analyses within a complete, automated
model gridded spatial data, and stars (Pebesma, 2018b) for
hydrological workflow, which includes data processing steps
reading, manipulating, writing, and plotting spatio-temporal
(before or after any GIS analyses) and any subsequent statis-
arrays. With all these packages, R now has full cartogra-
tical analyses. It is this integration of GIS as one step within
phy and mapping functionality and can produce sophisticated
the hydrological workflow that makes R extremely attractive.
maps that are either static or interactive. Packages such as
As a result, in recent years, R has become the go-to method
cartography (Giraud and Lambert, 2016) or tmap (Ten-
for geocomputation and geostatistics and can now be used as
nekes, 2018) can both be used for creating symbols, choro-
a GIS in its own right. Multiple books have been published
pleth, or other types of maps and for facilitating the visual-
on the topic of spatial analysis and mapping with R (Bruns-
ization of spatial data distributions in thematic maps. These
don and Comber, 2015) or, more broadly, geocomputation
two packages are quite similar in content but not in form:
with R (Lovelace et al., 2019), which includes topics such as
cartography uses the painter’s model, while tmap uses
reading and writing geographic data and making maps in R.
The Grammar of Graphics and allows users to draw static
Many methods are now implemented within R for han-
and dynamic maps with the same code. Additionally, ggmap
dling vectorial data, with packages such as sp (Pebesma and
(Kahle and Wickham, 2013) is commonly used for visual-
Bivand, 2005; Bivand et al., 2013) for plotting data as maps
izing, geolocating, and routing spatial data on top of static
or, for spatial selection, the package rgdal (Pebesma and
maps such as Google Maps; RgoogleMaps is used to in-
Bivand, 2005; Bivand et al., 2013), which provides bindings
teract with Google Maps, while the JavaScript leaflet
to the Geospatial Data Abstraction Library (GDAL) for read-
(Cheng et al., 2018) library can be used for creating inter-
ing and writing data and access to projection and transfor-
active web maps. R software can also be linked to a range
mation operations from the PROJ.4 (Urbanek, 2012) library,
of other GIS software to take advantage of specific capa-
package rgeos (Bivand and Rundel, 2018), which provides

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2949

bilities. R can access ArcGIS geoprocessing tools (ESRI, a dedicated R package called fuse (Vitolo et al., 2016b)
2018) by building an interface between R and the ArcPy that is a re-implementation of the FUSE 2011 model. The
Python side package using the RPyGeo package (Brenning vast majority of the models in the above packages are deter-
et al., 2018b). R can also call wrappers for GDAL–OGR util- ministic; however, the fuse package can also provide en-
ities (GDAL Development Team, 2018) using gdalUtils sembles of conceptual lumped hydrological models, and the
(Greenberg and Mattiuzzi, 2018). There are also interpreted hydromad package is intended to provide a flexible frame-
interfaces between the GRASS GIS (GRASS Development work for assembling different soil moisture accounting and
Team, 2019) and R from within the GRASS environment routing schemes.
or from R using the packages spgrass6 (Bivand, 2016) The above packages typically allow the user to run the
or rgrass7 (Bivand, 2018). R can be integrated with hydrological models, and usually provide some sample in-
the QGIS software (QGIS Development Team, 2018) using put data, with executable examples. Some packages provide
RQGIS (Muenchow et al., 2017) or with SAGA GIS (SAGA optimization algorithms, criteria calculation, and dedicated
Development Team, 2008) using RSAGA (Brenning et al., plotting functions (e.g. airGR and RHMS). Developing hy-
2018a). drological modelling packages in R is relatively straightfor-
ward because of the language’s flexibility; additionally, as
3.5 Packages for hydrological modelling discussed in Sect. 2.4, R can be connected to other pro-
gramming languages. This property allows R users to embed
The next step in a typical hydrological workflow is to conduct model codes that already exist into R and provides a more
hydrological modelling by using the data inputs prepared in friendly environment, as many packages ease the analysis of
previous steps. Hydrological modelling often proceeds by data and model simulations.
simplifying hydrological processes to test hypotheses about
the water cycle, manage water resources, reconstruct incom- 3.6 Packages for hydrological statistics
plete flow time series, predict extreme events (floods or low
flows), or anticipate the effects of future climatic or anthro- R was initially developed as a statistical computing language
pogenic changes. In Table 2 we highlight some of the key and is still the primary language in which novel statistical
packages that facilitate the implementation of certain hy- methods are coded and distributed. Statistical approaches are
drological models in R. As R can be used for every step employed for an extremely wide range of tasks in hydrology,
within the hydrological modelling process, from importing and it is virtually impossible to give complete coverage of all
and cleaning data to exploratory analyses, data modelling, possible packages that might be useful to hydrologists. The
data analysis, and graphical visualization, it represents an skimr package provides compact and flexible summaries
ideal language for hydrological modellers. of data; it can be used with pipes and displays nicely in
Several well-known hydrological models are provided the console. Many estimating procedures can be carried out
in these packages, such as the HBV model in the using the base-R stats package, which includes, for ex-
TUWmodel package (Viglione and Parajka, 2019), TOP- ample, correlation analysis and Mann–Kendall testing, lin-
MODEL in the packages topmodel (Buytaert, 2018) and ear regression, Poisson regression, and Gamma regression.
dynatopmodel (Metcalfe et al., 2015, 2018), SWAT in There are also generalist packages for non-parametric trend
SWATmodel (Fuka et al., 2014), GR4J in airGR (Coron tests such as trend (Pohlert, 2018), which includes a broad
et al., 2017, 2018), and hydromad (Andrews et al., 2011; range of tests for trend detection, correlation, and detection
Andrews and Guillaume, 2018). Some packages also in- of change points or non-randomness. Many general mod-
clude degree-day snow models (e.g. airGR, hydromad, elling packages have been found to be useful by hydrologists,
and TUWmodel) that are used in nival basins to simulate for example mgcv (Wood, 2017), VGAM (Yee et al., 2015),
the accumulation and melt of the snowpack, which greatly and GAMLSS (Rigby and Stasinopoulos, 2005), which im-
impacts the flow regimes. Many of the models included in plements generalized additive regression models for a large
these packages are lumped (i.e. consider the catchment as a number of distributional families. While mgcv can be useful
single unit with area-averaged variables) or conceptual (i.e. for more complex smoothing approaches (e.g. tensor prod-
provide a simplified representation of the physical processes uct smooths or varying coefficient models), the focus of
with empirical equations describing the interactions between GAMLSS is to develop flexible models for a large class of
the processes) models. Some packages, such as TUWmodel distributions which are not part of the exponential family of
and topmodel, allow a spatial distribution of the hydro- distributions, allowing for parameters other than the location
logical processes. TUWmodel, for instance, allows the user to be modelled as a smooth function of the covariates of in-
to implement a semi-distributed application with differentia- terest. A hydrologist might therefore choose which package
tion into elevation zones, while topmodel allows the user to use depending on the most likely distribution of the data
to make topographic index classes from a topographic index which are being analysed and the complexity of the analysis.
map. The FUSE model (Clark et al., 2008), originally im- The caret package (Kuhn et al., 2018) is more commonly
plemented in Fortran, is still actively developed and also has used for predictive modelling and machine learning, as it al-

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2950 L. J. Slater et al.: R in Hydrology

Table 2. Examples of packages for hydrological modelling. See the Hydrology Task View for latest additions: https://cran.r-project.org/web/
views/Hydrology.html.

Package Description
airGR Suite of GR hydrological models for precipitation-runoff modelling (Coron et al., 2017, 2018)
brook90 Implementation of the BROOK90 hydrologic model
(Federer, 1995; Schmidt-Walter, 2018; Kronenberg and Oehlschlägel, 2019)
dynatopmodel Implementation of the dynamic TOPMODEL hydrological model (Metcalfe et al., 2015, 2018)
Ecohydmod Ecohydrological modelling (Souza, 2017)
fuse Ensemble hydrological modelling (Vitolo et al., 2016b)
hydromad Hydrological model assessment and development (Andrews et al., 2011; Andrews and Guillaume, 2018)
RHMS Hydrologic modelling system for R users (Arabzadeh and Araghinejad, 2018)
topmodel Implementation of the hydrological model TOPMODEL in R (Buytaert, 2018)
TUWmodel Lumped/Semi-distributed hydrological model for education purposes (Viglione and Parajka, 2019)

lows the user to develop an impressive range of predictive 3.7 Packages for static and dynamic hydrological data
models (e.g. neural networks, deep learning, and decision visualization
trees).
There are many packages available for common hydro- Data visualizations play an important role in hydrological
logical tasks. A comprehensive set of functions for carry- analysis: R makes them straightforward to implement and
ing out extreme value analysis (Coles, 2001) can be found allows considerable flexibility. R includes three main fami-
in the extRemes package (Gilleland and Katz, 2016), and lies of graphics packages: a painter model, natively present
a more complete overview can be found in the CRAN Ex- in R and based on the S language’s GR-Z model (Becker and
treme Value Analysis Task View. nsRFA consists of a col- Chambers, 1977), the trellis graphs (e.g. the lattice pack-
lection of statistical tools for objective (unsupervised) appli- age; Sarkar, 2008) initially implemented in S, and The Gram-
cations of the regional frequency analysis methods in hydrol- mar of Graphics (Wilkinson, 1999). The last two families
ogy (Viglione, 2018). L-moments can be implemented using are both based on the grid package (R Core Team, 2018),
the lmom Hosking (2019b) package, while the lmomRFA a low-level abstraction layer that allows the development of
package (Hosking, 2019a) enables regional frequency anal- graphical packages with different philosophies, which means
ysis. The lfstat (Koffler et al., 2016) package provides that the created graphics can be stored in objects to be up-
functions to compute statistics and plots for low flows sim- dated and plotted again later.
ilar to those in the manual on low-flow estimation and pre- base-R can produce publication-quality figures; it includes
diction (WMO, 2009). Many of the standard model evalu- a series of functions and methods that allow the user to
ation metrics are provided directly within these packages. plot various types of visualizations and the output of sta-
The caret package, for instance, imports other packages, tistical models. Visualizations are produced in base-R us-
such as ModelMetrics (Hunt, 2018), to facilitate model ing the graphics package (R Core Team, 2018), which
evaluation directly. A range of packages have also been de- relies on the philosophy of superimposing elements of the
veloped specifically for model evaluation. The hydroGOF graphics (with no provision for deleting an element once it
package (Zambrano-Bigiarini, 2017a) provides goodness-of- is drawn) and includes a range of functions to add straight
fit functions specifically for comparison of simulated and ob- lines, arrows, axes, boxes, grids, legends, or annotation to
served hydrological time series. In Table 3 we present a brief a plot. While visualizations produced in base-R are highly
overview of some other packages for hydrological statistics. customizable, other packages provide more consistent in-
For a broader overview of available packages and further ex- teractions and a suite of highly useful functions to sum-
amples, we point the reader to the CRAN Task View on ma- marize, highlight, and split and/or layer data with a min-
chine learning and statistical learning (https://cran.r-project. imal amount of code. A community favourite is the pack-
org/web/views/MachineLearning.html). age ggplot2, created by Wickham (2016b), which allows
a high level of flexibility and “tuning” of the graphs de-
pending on the users’ needs. ggplot2 is an implemen-
tation of The Grammar of Graphics and allows users to
build almost any type of graphic (see the R graph gallery at

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2951

Table 3. Examples of packages for hydrological statistics.

Package Description
berryFunctions Function collection related to plotting and hydrology (Boessenkool, 2018)
hydroGOF Goodness-of-fit functions for comparison of simulated and observed hydrological time series
(Zambrano-Bigiarini, 2017a)
hydrolinks Hydrologic network linking data and tools (Winslow et al., 2018)
hydrostats Hydrologic indices for daily time-series data (Bond, 2018)
hydroTSM Time-series management, analysis and interpolation for hydrological modelling (Zambrano-Bigiarini, 2017b)
lfstat Calculation of Low Flow Statistics for daily stream flow data (Koffler et al., 2016)

https://www.r-graph-gallery.com). ggplot2 also contains Choosing the appropriate colour gradients for hydrolog-
functions like “facets” (https://plot.ly/ggplot2/facet), which ical graphs and maps is key. It is widely accepted now
allow the user to split and plot the data by categories in many that certain colour schemes, and notably the infamous rain-
different rows or columns. Figure 4 provides a hydrologi- bow colour scale, are poor choices for data visualization
cal example of faceting where a statistical model is visu- (Light and Bartlein, 2004; Stauffer et al., 2015). The rain-
alized for different seasons (rows) and different peak-over- bow scheme has been shown to distort perceptions of data
threshold quantities (columns). and alter meaning by creating false boundaries between val-
Dynamic charts – where the user can, for instance, hover ues; additionally it is not colourblind-safe, and other alterna-
over one or multiple points to read the associated data or tives like perceptually uniform colour maps have been sug-
metadata (e.g. a hydrometric station number or the value gested (Crameri, 2018). The R language is strong in the
of a point) – have also grown in popularity in hydrological area of colour gradients, and there are many colourblind-
analyses in recent years. These dynamic graphics are par- friendly palettes available for hydrology that follow effective
ticularly useful in inspecting data, such as outliers, or ex- data visualization guidelines (Kelleher and Wagener, 2011).
plaining an analysis when teaching hydrology in the class- There are both manually defined and predefined palettes us-
room (e.g. by zooming in on different parts of a time se- ing packages such as RColourBrewer (Neuwirth, 2014),
ries). Dynamic graphics including maps can be created by colorspace (Zeileis et al., 2019), colorRamps (Keitt,
using the plotly package (Sievert, 2018), a graphic li- 2012), or viridis (Garnier, 2018). For example, the
brary that allows the user to make graphs interactive with colorspace package can be used for colour palettes based
minimal extra code. A number of JavaScript-based visual- on hue chroma luminance (HCL colour palettes are based on
ization libraries can also help achieve dynamic graphics. how humans perceive colour, in contrast to the RGB colour
For interactive time-series data requiring axis display fea- space, which is based on technical demands of TV/computer
tures such as zooming and panning and highlighting of se- screens) in meteorological visualizations (Stauffer et al.,
ries and points, the dygraphs package (Vanderkam et al., 2015).
2018) provides an interface to the JavaScript charting li-
brary. The manipulate package (Allaire, 2014) allows the 3.8 Packages for creating presentations and documents
user to easily add sliders and other control tools to other-
wise static plots. Other JavaScript-based packages include A vast array of packages have been developed in R for creat-
rbokeh (Hafen and Continuum Analytics, Inc., 2016), ing dynamic presentations and documents, which are partic-
which provides an interface to Bokeh, allowing the user to ularly useful for illustrating hydrological concepts. Dynamic
create web-based plots with hover and dynamic functional- interfaces and web-based applications can be created with
ities. rAmCharts (Thieurmel et al., 2018) creates interac- shiny (Chang et al., 2015), such as the airGRteaching
tive charts based on the amCharts JavaScript library, while (Delaigue et al., 2018a, b) interface (Fig. 6; see Sect. 5.5). R
the highcharter (Kunst, 2017) package is based on the can also be used to generate animated GIF files for presen-
Highcharts JavaScript library of graphics. Examples of all tations, for example to highlight temporal changes in land
of these implementations (including leaflet, dygraphs, cover or reservoir levels from earth observation. GIFs can be
plotly, rbokeh, highchart, and other visualization li- created using, for example, gganimate (Pedersen, 2018)
braries) can be found at https://www.htmlwidgets.org. We to animate ggplot2 and create videos and animated image
encourage the reader to explore these HTML widgets, as they files or caTools (Tuszynski, 2018) for reading and writing
show how simple it is to implement dynamic graphics with GIF and ENVI (flat-binary raster files with an accompanying
just a line or two of R code. ASCII header file) files.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2952 L. J. Slater et al.: R in Hydrology

Additionally, various packages have been designed 4.2 Integrated development environments (IDEs):
to produce interactive maps, such as leaflet facilitating the use of R
(Cheng et al., 2018), leafletR (Graul, 2016),
plotGoogleMaps (Kilibarda and Bajat, 2012), or IDEs are software applications that are used to facilitate cod-
googleVis (Gesmann and de Castillo, 2011). R also ing by providing the code editor, compiler, or interpreter and
offers many tools for creating websites or blog posts, debugger within a single graphical user interface (GUI). A
with packages like rmarkdown (Allaire et al., 2018c), range of IDEs exist for R, such as Eclipse – StatET, (an
blogdown (Xie et al., 2017), or pkgdown (Wickham and Eclipse-based IDE; e.g. des Riviêres and Wiegand, 2004;
Hesselberth, 2018). Wahlbrink, 2016), Emacs Speaks Statistics (ESS; an add-on
Presentations, books, reports, and documents can be gen- package for GNU Emacs; Rossini et al., 2004), Microsoft’s
erated in LaTeX, or Markdown, natively with Sweave func- R Tools for Visual Studio (RTVS; a plug-in for the Microsoft
tionalities or with packages such as knitr (Xie, 2018), Visual Studio IDE; e.g. Beard, 2016), RKWard (which in-
markdown (Allaire et al., 2018a), rmarkdown (Allaire tegrates with the KDE desktop environment; Rödiger et al.,
et al., 2018c), pagedown (to paginate the HTML output of 2012), Tinn-R (a replacement for the basic code editor de-
R Markdown with CSS for printing; Xie and Lesur, 2019), signed to replace Rgui; Faria et al., 2008), or Vim or Neovim
or bookdown (Xie, 2016). These packages facilitate the au- (a terminal-based working environment designed to facilitate
tomation of such documents (e.g. monthly reports) through working in a pure command-line interface; e.g. Neil, 2018).
in-line text tokens that are dynamically linked to data in R’s The RStudio IDE (RStudio Team, 2018) is the most popu-
workspace. lar of the IDEs. RStudio facilitates the uptake of R by hydrol-
ogists by providing a helpful research tool and training envi-
ronment to new and experienced programmers alike. RStudio
4 Challenges and solutions when using R in hydrology is available in two editions: an open-source edition and an en-
terprise edition with a commercial license. Both can run on
4.1 Hydrological libraries, documentation, and a desktop (RStudio Desktop) or server (RStudio Server) and
vignettes can be installed on different platforms (Windows, macOS,
and Linux). Most hydrologists use the free RStudio Desk-
For most hydrologists who are new to R, the initial hurdle top edition, although university departments and companies
is understanding how to install libraries and use packages to increasingly offer server editions too. RStudio’s features in-
explore their own datasets. The book R packages (Wickham, clude a console; a syntax-highlighting editor that supports
2015) is freely available online and explains everything from direct code execution; integrated R help and documentation;
the basic installation of packages to the role of metadata, un- support for version control systems; and tools for plotting,
derstanding documentation, the role of vignettes, and best history, debugging, and workspace management.
practice on GitHub (one common collaboration and version The RStudio environment makes it straightforward for hy-
control platform). drologists to conduct a range of tasks (e.g. visualize data;
R packages centralized on CRAN are structured similarly, create dynamic graphs or web applications with shiny; use
with a reference manual, source code, a license file, and other version control; or develop and view R Markdown presenta-
common elements. The code and documentation of all pack- tions, for example in LaTeX, HTML, or presentation slides),
ages is verified before they are uploaded to CRAN. R pack- all within the IDE. Other advantages of RStudio include the
ages ideally provide two forms of documentation: a short easy access to the help window, the ease of package man-
form (help pages) and a long form (vignettes), which are agement and updating, code debugging, or even the easy de-
both complementary and serve different purposes (Wickham, velopment of packages in one location. All of these benefits
2015). The help pages explain what each function does, de- contribute to facilitating open hydrological science. RStudio
scribe the required input and the produced output, and usu- version 1.2 includes many new features to help interact with
ally include a section with executable examples. Vignettes, other programming platforms, such as the reticulate
in contrast, are tutorials that illustrate how R packages and (Allaire et al., 2018b) and r2d3 (Luraschi and Allaire, 2018)
their functions are used, often with discussion of the out- packages, which make it easy to call Python and D3 from
puts. However, not all packages include a link to a vignette within R sessions and R Notebooks. An exhaustive list of
on the CRAN repository, as this is not compulsory. Develop- features can be found on the RStudio website (https://www.
ing clear and useful vignettes is one of the key challenges in rstudio.com/products/RStudio).
facilitating the uptake of new packages and methods; in fact
these are key to reducing the misuse of software and ensuring
that the package users understand the methods. Use cases can
be written as blog posts or tutorial-style papers, with expla-
nation of how to correctly interpret and implement a specific
method and helping the community move forward.

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2953

4.3 Big data and parallel computing challenges in a scalable platform offering parallelized implementations of
hydrology supervised and unsupervised machine learning algorithms.

In the early years of R, the software was unable to han-


dle large data files exceeding millions of rows or complex 5 A roadmap for the future of R in hydrology
data formats. However, both of these limitations have since
been overcome. Some of the early packages for handling As we have shown above, the development of R fosters
large data files include bigmemory (Kane et al., 2013) or progress in hydrology. In this section we discuss what we
biganalytics (Emerson and Kane, 2016), where ma- perceive as some of the future avenues for enhancing hydro-
trices are allocated to shared memory and use memory- logical research or operational hydrological practice with R
mapped files. More recently, the package data.table and how we can achieve these as a community.
(Dowle and Srinivasan, 2018) has gained increasing popu-
5.1 Sharing R code with the community
larity for enhanced data frames, allowing fast aggregation
of large data (e.g. 100 GB in RAM) or fast ordered joins. Open research practices bring significant benefits to re-
In hydrology, some of the spatial data handling packages searchers (McKiernan et al., 2016), such as increases in ci-
are particularly relevant, such as the sf package (Pebesma, tations, media attention, potential collaborators, job oppor-
2018a) for large shape files or the feather (Wickham, tunities, and funding opportunities. Most importantly, shar-
2016a) package for feather files, a lightweight binary colum- ing code increases the likelihood that an approach will be
nar data store designed for maximum speed. Database con- used by other scientists in their research and saves new users
nections can be established using a range of packages such as the trouble of “reinventing the wheel” and writing codes that
RPostgreSQL (Conway et al., 2017) or RSQLite (Müller have already been developed by others. There are many dif-
et al., 2018). Distributed data frames can be implemented us- ferent platforms for sharing and publishing R code such as
ing packages such as sparklyr (Luraschi et al., 2018). GitHub, Figshare, and RPubs or Plotly (also for dashboards
As the volume of available data increases and hydrologists and interactive plots). To obtain a DOI, users may wish to use
use a greater number of models and ensembles, parallel com- repositories such as Zenodo, a general purpose open-access
puting – where many calculations are carried out simultane- repository which allows researchers in the sciences and hu-
ously instead of sequentially – has become an essential tool manities to deposit datasets, research software, and create re-
in computational hydrology and has sped up analyses. For ports. The data publisher PANGAEA, additionally, is specif-
instance, instead of using traditional for-loops (an approach ically tailored to archiving, publishing, and reuse of data in
where one action is carried out over a dataset iteratively), the earth and environmental sciences. For further guidance, some
data may be broken down into groups (e.g. by year or by sea- of these platforms are discussed in the code and data policy
son), and functions can be applied to each group in parallel. section of the open-access journal Geoscientific Model De-
The performance boosts that can be achieved by parallelizing velopment.
the code (i.e. using more than one core at a time) are consid-
erable. Even without access to a high-performance computer 5.2 R packages as a driver of progress in hydrology
or cluster, it is possible to perform hydrological tasks faster,
since most local machines now have between 4 to 16 cores. The consistent stream of new R packages has been a great
R has multiple facilities and packages for enabling the paral- driver for progress not only in hydrology but even in science
lelization of code execution. At the most simple level, base-R more broadly, as packages favour the uptake and develop-
functions like lapply and sapply can be used to apply a spe- ment of methods. Additionally, the open-source nature of R
cific function to a vector or list input, which can speed up packages means that different users can contribute feedback
analyses considerably. For instance, the base-R parallel to R package developers and help enhance existing code. R
package for distributed computing provides methods to ac- users can raise issues for certain packages directly on on-
cess additional computational power by allocating available line platforms hosting the repositories (such as GitHub or
processing cores into a cluster. The foreach (Microsoft GitLab) to foster an online-documented discussion with the
and Weston, 2017) and doParallel (Microsoft Corpora- package developers (generating interaction in the commu-
tion and Weston, 2018) packages can also be used together nity). Package authors can also add a bug report link or an
to execute “for-each” loops in parallel. email address in their package description file (common best
Other packages that are widely used for parallel computing practice for developers) to specify how they prefer to receive
in hydrology and other areas include the snowfall (Knaus, bug reports. This feedback between users and developers is
2015) package, which facilitates the development of parallel one key route to scientific progress. Users can identify is-
R programs, e.g. by including extended error checks. Addi- sues or suggest improvements by commenting on online col-
tionally, some packages have parallel functionalities that are laboration platforms (e.g. GitHub or GitLab) or by email-
integrated directly within the package, such as the h2o pack- ing the developer or maintainer. Most packages are hosted
age (LeDell et al., 2018) that provides an interface to H2O, on these repository hosting platforms before becoming avail-

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2954 L. J. Slater et al.: R in Hydrology

able via the CRAN archive, ensuring that a certain standard vided by rOpenSci. It is worth noting that when writing new
and best practice are met. Although CRAN itself does not packages, the open-source approach has both pitfalls (risk
have any mechanism to check the quality or cleanness of of errors in new packages) and strengths (community review
the code, there is a suite of packages that are used to (i) and range of tests that can be implemented via the above-
ensure clean code and documentation that follow a widely mentioned packages).
accepted style guide, such as the lintr (Hester, 2018),
goodpractice (Csardi and Frick, 2018), and hunspell 5.3 Harmonizing hydrological workflows
(Ooms, 2018) packages and to (ii) rigorously test the func-
tions against predefined outcomes, using for example the One of the main challenges today for hydrological work-
testthat package (Wickham, 2011). In comparison with flow harmonization is to standardize calls for data which
GitHub, CRAN is an organized repository which provides are structured in different ways by data providers around the
executables for several platforms, whereas finding an hydro- world. While the number of packages for hydrological data
logical R package on GitHub can be difficult. The compar- retrieval has grown considerably (see Table 1), the packages
ison between the two is somewhat like visiting a curated are structured differently because they were set up indepen-
art auction versus an antique store. Additionally, CRAN has dently and because the underlying hydrological and hydro-
more thorough checks and gives visibility and/or searchabil- metric datasets differ from country to country. As more na-
ity to a package, also signalling that the author intends to tions develop similar hydrological data acquisition packages,
maintain the package over the long term. we believe it would be worth implementing a common syn-
Developing an R package requires a structured approach, tax and data output form. For example, it would be ideal to
just like writing a scientific paper. There are many generalist use consistent APIs and output objects across packages. Sug-
resources for writing R packages, such as the R package book gesting the “ideal” format is beyond the scope of this paper,
(see http://r-pkgs.had.co.nz; Wickham, 2015) or a suite of but a potential task force might be set up to help draft a way
video tutorials on YouTube. The main requirements for pub- forward for the community. There is currently no effort to
lishing a package are listed on the CRAN website. Provid- combine data retrieval packages from different regions, but
ing documentation and tutorials, e.g. via blog posts or good it might be worth implementing a meta-package with func-
README files, is essential. Package authors can also pro- tions that convert hydrometric data from other packages to
vide user-friendly and modular functions to aid maintenance a standard format or one for hydrological models to be run
and future development (e.g. through external contributions within the same framework. Additionally, the growing ten-
or suggested changes on online platforms). The RHub ser- dency towards data standardization at the global level may
vice also provides a “build and check” service for R packages facilitate the development of consistent data retrieval pack-
(Csárdi, 2017). ages. Examples of global data standards include WaterML,
Authoring hydrology-based R packages that can stand up the Open Geospatial Consortium standards for hydrological
to scientific scrutiny and ensure user-friendliness is not a mi- time series, or TimeseriesML, a more generic candidate stan-
nor task, and such investment should be recognized within dard currently under discussion. As more water agencies and
the community. Fuelling the development and dissemination data providers adopt such standards, it will become much
of new R-based methods is therefore the joint responsibil- easier to develop consistent data retrieval packages, and in
ity of developers, authors, and journal editors. If developers theory we may no longer require different packages for data
include digital object identifiers (DOIs) as well as instruc- retrieval because the only component that should change is
tions for citation within their software, then authors can sub- the server endpoint.
sequently cite these packages. The adequate reference or ref-
erences can be obtained with the citation function for every 5.4 APIs: hydrological data acquisition and provision
package. The references generally comprise a reference to
the package (with CRAN link and package version, which APIs play a key role in hydrological data acquisition and
is key for encouraging reproducibility) and sometimes also provision and are likely to become increasingly important in
include an additional journal paper reference. If both are the future. An API is a set of code which usually includes
available, then ideally both must be cited to provide recog- subroutine definitions, communication protocols, and tools
nition of computational scientists’ contribution to the hydro- for building software and interacting with different datasets.
logical community and to enhance the reproducibility of the APIs are specific to the use case by definition, but the inter-
research. Editors might also support reproducibility via spe- face is often provided in HTTP (i.e. web protocol) so that
cial issues or sections for technical notes. Dedicated software requests and responses can be made and received by a wide
journals such as the Journal of Open Source Software can range of languages or systems. For R users, hydrological in-
be used to publish brief, technical descriptions of R pack- teraction with HTTP APIs usually comes in the form of data
ages. Any potential apprehensions for publishing such meth- acquisition packages such as the aforementioned packages
ods (e.g. due to a lack of scientific scrutiny) can be alleviated rnrfa (Vitolo et al., 2016a), tidyhydat (Albers, 2017),
through software peer review initiatives such as those pro- or daymetr (Hufkens et al., 2018). These packages provide

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2955

means of posting requests via the R command line and then for educational purposes. The airGRteaching package
return an R object for subsequent manipulation. Internally, (Delaigue et al., 2018a, b) provides access to a suite of GR
the source code translates all inputs and outputs to and from rainfall–runoff models such as GR4J for use by students with
HTTP. Programmatically accessing a variety of vast online limited programming skills: only three basic functions are
resources (i.e. data) in this way has considerably advanced needed to prepare the data, calibrate a model, and run or eval-
our understanding of the earth sciences. uate a simulation, and a single function can produce plots
Recent developments, however, have opened up a new, and directly using objects from the three previously mentioned
arguably under-utilized, approach to APIs for the R commu- functions. In addition, a graphical shiny web application
nity: rather than exploiting an existing interface, R users can is included to explore data and model results with automatic
now increasingly rely on a set of tools to develop and make updating of the plots and scores when the model parameters
their own APIs accessible for use by third parties via HTTP. are modified by students; the app allows users to explore the
Noteworthy projects here are OpenCPU (client and scalable internal fluxes and state variables of the models (Fig. 6). Such
cloud implementation; Ooms, 2014) and RStudio’s plumbr tools can be used for understanding and illustrating the main
package (Lawrence and Wickham, 2018). API development hydrological processes and concepts and for relating them to
is likely to become a major avenue of future advances in sci- hydrological models’ components and parameters.
entific computing within the hydrological community as well There is now an increasing number of online applica-
as interaction beyond the scientific realm. Such APIs can pro- tions that allow beginners to learn R in a sandbox, i.e. a
vide access to the latest raw or analysis-ready data, methods, virtual space for testing coding online. Sandboxes are par-
or even entire (statistical) models written in R. ticularly useful for introducing basic methods in computa-
The simplicity and ubiquitous implementation of HTTP tional hydrology without having to master the technicalities
have vast implications, of which we highlight four. (1) Com- of R. Examples of R sandboxes include the RStudio Cloud
mon issues with interoperability between languages can be (https://rstudio.cloud), which can be used to learn, teach,
overcome, and more attention can be afforded to gaining or test R code. Another sandbox, initially called R-Fiddle,
insights rather than developing (often convoluted) language is now called datacamp-light (https://github.com/datacamp/
bridges (termed a “separation of concerns”; Heineman and datacamp-light). Many other R sandboxes can be found on-
Council, 2001). This means, for the first time, that fully line. Thus, rather than installing R on multiple PCs, sand-
seamless interaction between research groups working in dif- boxes can be used by educators or lecturers by asking stu-
ferent languages is possible (e.g. between R, Python, and dents to connect directly to the web.
MATLAB). (2) Computational infrastructure can be scaled
with comparatively little technical knowledge, increasing R’s
5.6 Developing the community: short courses, help
aptitude to a wider range of applications. (3) Outputs can
desks, and meet-up events
be made accessible to third parties with or without a deeper
understanding of the underlying science. (4) Empirical data
are rarely “clean”, and scientific computing hence has to be This paper reflects the strong collective desire to develop
adaptable: R source code can be altered to account for chang- the community of computational hydrologists in R. As men-
ing data, while maintaining a standardized, public-facing tioned in Sect. 2.5, the R-Hydro community has been meet-
API. To highlight potential strengths of such APIs, we pro- ing regularly in recent years at the EGU General Assembly
vide a brief, interdisciplinary use-case scenario rooted in nat- during the short course Using R in Hydrology. This course
ural hazard management and hydrological sciences in Fig. 5. is run annually by the YHS and is typically attended by a
wide range of hydrologists, ranging from beginners to more
5.5 Teaching hydrology in R experienced users (Fig. 2). The resources and teaching pre-
sentations from the short course are made available to the
Due to its relative ease of use and open-source nature, R is community online on the YHS GitHub pages (https://github.
increasingly being used as an interactive tool for teaching com/hydrosoc/) and archived on the Zenodo repository (see
in the hydrological sciences. Many examples of typical hy- Boessenkool et al., 2017; Slater et al., 2018; Hurley et al.,
drological analyses can be found online as tutorials (see for 2019). These presentations include a range of topics, such as
example, Hurley, 2018). The USGS also publish relevant ex- obtaining, cleaning, and visualizing hydrological data with
amples as a hydrological blog at https://owi.usgs.gov/blog, R; parallel and high-performance computing for hydrolo-
which may be of interest to the community. gists; automating tasks; using R Shiny with hydrological
R packages such as airGRteaching or TUWmodel data; modelling the hydrological cycle in snow-dominated
have also recently been developed to facilitate teach- catchments; community-led initiatives; using R as a GIS; dis-
ing of hydrological modelling. The TUWmodel package charge time-series visualization; extreme value statistics; hy-
(Viglione and Parajka, 2019) provides a lumped concep- drological modelling; trend analysis; accessing hydrological
tual rainfall–runoff model based on the well-known HBV data using web APIs; extracting gridded netCDF data; report
model (Bergström and Forsman, 1973) and is designed generation; and other hydrological tasks in R.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2956 L. J. Slater et al.: R in Hydrology

Figure 7. The R community. Left: the R meet-up groups (https://www.meetup.com/topics/r-project-for-statistical-computing). Right: the
R-Ladies global organization (https://rladies.org/about-us).

Many other R conferences will be of relevance to the read- 6 Conclusions


ers, including the useR! conference, RStudio, satuRdays, or
eRum. These conferences are not specific to hydrology and
earth sciences but usually have some discipline-specific ses- Over the last decade, the open-source programming language
sions as well as sessions and short courses of general interest R has acquired a central role in hydrological research as well
for learning R, including best practice, spatial analysis, and as in the operational practice of hydrology. With the rapidly
statistical methods. Many of these conferences also stream increasing number of packages that are now available for ev-
the talks and/or make resources available after the event. ery step of the hydrological workflow, R facilitates a broad
The global reach of R meet-up groups has also grown range of hydrological analyses from start to finish. This paper
rapidly, such as the official R user group meet-up (http: provides an overview of the use of the open-source program-
//r-users-group.meetup.com). Many local initiatives for R ming language R in hydrology by describing these packages
users have regular meet-ups and seminar series and can be as well as the influence of R on the discipline. Both the flexi-
found either on the meet-up website or on social media web ble nature of the language and the diverse range of computa-
pages, such as Twitter (e.g. https://twitter.com/rusersoxford). tional, visualization, and modelling tools (physically based
There is also an ongoing push for greater inclusivity of under- and statistical) have facilitated the testing of hydrological
represented groups in programming, as exemplified by the theories over a range of spatial and temporal scales as well
rapid growth of the global R-Ladies movement (Fig. 7). as interactive teaching of hydrology within the classroom.
In addition, the computational community has been try- By sharing codes, proposing new packages, or contribut-
ing to provide support to other programmers by running cod- ing to the improvement of existing packages, we believe that
ing help desks such as at the American Geophysical Union the R-Hydro community will continue to facilitate further
(AGU) 2018 fall meeting in the career centre. Geoscientist advances in hydrology, with wide-ranging improvements of
volunteers ran the desk in 2018 to provide perspective and hydrological theory, models, and tools. These new computa-
advice to other coders, with a range of short, 10 min tuto- tional tools and approaches are essential to achieving long-
rials on topics such as keeping track of code versions with term goals in hydrology such as the IAHS Science Plan for
GitHub, making high-quality plots, or using a new package the decade 2013–2022, “Panta Rhei: Change in hydrology
or library. We anticipate that such help desks, short courses, and society”, which seeks to improve the assessment, attri-
and meet-up sessions will continue to help grow the compu- bution, and modelling of hydrological change. The rise of
tational hydrology community in future years. computational hydrology also plays a key role in enhancing
the reproducibility of science and the computational literacy
of both scientists and practitioners. Within scientific research
labs, we anticipate that committing code to a repository will
become standard practice, as will the submission and review

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2957

of code along with papers, as part of the scientific publication Allaire, J., Xie, Y., McPherson, J., Luraschi, J., Ushey, K., Atkins,
process. In the future, as open-source programming, data sci- A., Wickham, H., Cheng, J., and Chang, W.: rmarkdown: Dy-
ence, and computational modelling become more widespread namic Documents for R, available at: https://CRAN.R-project.
in schools and universities, it is plausible to expect that R will org/package=rmarkdown, R package version 1.10, 2018c.
continue to play an increasing role in hydrology. Andrews, F. and Guillaume, J.: hydromad: Hydrological Model
Assessment and Development, available at: http://hydromad.
catchment.org, R package version 0.9-26, 2018.
Andrews, F., Croke, B., and Jakeman, A.: An open soft-
Data availability. The data used to create Fig. 1 are publicly avail-
ware environment for hydrological model assessment and
able; code to download the data and reproduce the figure is provided
development, Environ. Modell. Softw., 26, 1171–1185,
as a Supplement to this paper. All URLs mentioned in the paper
https://doi.org/10.1016/j.envsoft.2011.04.006, 2011.
were last accessed on 23 June 2019.
Arabzadeh, R. and Araghinejad, S.: RHMS: Hydrologic Modelling
System for R Users, available at: https://CRAN.R-project.org/
package=RHMS, R package version 1.4, 2018.
Supplement. The supplement related to this article is available Archfield, S. A., Hirsch, R. M., Viglione, A., and
online at: https://doi.org/10.5194/hess-23-2939-2019-supplement. Blöschl, G.: Fragmented patterns of flood change across
the United States, Geophys. Res. Lett., 43, 10–232,
https://doi.org/10.1002/2016GL070590, 2016.
Author contributions. All authors co-wrote the paper. Backus, J.: The history of Fortran I, II, and III, ACM Sigplan No-
tices, 13, 165–180, 1978.
Bates, D., Lai, R., Byrne, S., and contributors: RCall package, avail-
Competing interests. The authors declare that they have no conflict able at: https://github.com/JuliaInterop/RCall.jl, 2015.
of interest Beard, B.: Setup and Installation of R Tools for Visual Studio, in:
Beginning SQL Server R Services, 33–71, Apress, Berkeley, CA,
2016. Beard, B., 2016. Setup and Installation of R Tools for Vi-
Acknowledgements. We thank two anonymous reviewers, Michael sual Studio. In Beginning SQL Server R Services (pp. 33-71).
Stoelzle, and Paul Astagneau for comments that improved the paper. Apress, Berkeley, CA.
We also thank all those who have contributed to the R-Hydro com- Becker, R. A. and Chambers, J. M.: GR-Z: A System of Graph-
munity and the R community more broadly, whether by developing ical Subroutines for Data Analysis, in: Computer Science and
and sharing their code or helping and teaching others to use these Statistics, 409–415, U.S. Dept. of Commerce, National Bureau
tools. In particular, we thank the guest speakers who participated in of Standards: for sale by the Supt. of Docs., U.S. Govt. Print.
the Using R in Hydrology EGU short course. Off., Gaithersburg, Maryland, 1977.
Becker, R. A. and Chambers, J. M.: S: an interactive environ-
ment for data analysis and graphics, The Wadsworth statis-
tics/probability series, Wadsworth Advanced Book Program,
Review statement. This paper was edited by Erwin Zehe and re-
Belmont, California, 1984.
viewed by Michael Stoelzle and two anonymous referees.
Bellosta, C. J. G.: rPython: Package Allowing R to Call Python,
available at: https://CRAN.R-project.org/package=rPython, r
package version 0.0-6, 2015.
Bengtsson, H.: R.matlab: Read and Write MAT Files and Call MAT-
References LAB from Within R, available at: https://CRAN.R-project.org/
package=R.matlab, r package version 3.6.2, 2018.
Abbott, M. B.: Hydroinformatics: information technology and the Berghuijs, W., Woods, R., and Hrachowitz, M.: A precipitation shift
aquatic environment, Avebury Technical, Aldershot, 1991. from snow towards rain leads to a decrease in streamflow, Nat.
Addor, N., Newman, A. J., Mizukami, N., and Clark, M. P.: The Clim. Change, 4, 583, https://doi.org/10.1038/nclimate2246,
CAMELS data set: catchment attributes and meteorology for 2014.
large-sample studies, Hydrol. Earth Syst. Sci., 21, 5293–5313, Bergström, S. and Forsman, A.: Development of a conceptual de-
https://doi.org/10.5194/hess-21-5293-2017, 2017. terministic rainfall-runoff model, Nordic Hydrol., 4, 147–170,
Albers, S.: tidyhydat: Extract and Tidy Canadian Hydromet- https://doi.org/10.2166/nh.1973.0012, 1973.
ric Data, The Journal of Open Source Software, 2, 511, Beven, K.: TOPMODEL: a critique, Hydrol. Process.,
https://doi.org/10.21105/joss.00511, 2017. 11, 1069–1085, https://doi.org/10.1002/(SICI)1099-
Allaire, J.: manipulate: Interactive Plots for RStudio, available 1085(199707)11:9<1069::AID-HYP545>3.0.CO;2-O, 1997.
at https://CRAN.R-project.org/package=manipulate, r package Bezanson, J., Karpinski, S., Shah, V. B., and Edelman, A.: Julia: A
version 1.0.1, 2014. fast dynamic language for technical computing, arXiv preprint
Allaire, J., Horner, J., Xie, Y., Marti, V., and Porte, N.: mark- arXiv:1209.5145, 2012.
down: “Markdown” Rendering for R, available at: https://CRAN. Bivand, R.: spgrass6: Interface between GRASS 6 and R, avail-
R-project.org/package=markdown, r package version 0.9, 2018a. able at: http://CRAN.R-project.org/package=spgrass6, R pack-
Allaire, J., Ushey, K., and Tang, Y.: reticulate: Interface to “Python”, age version 0.8-9, 2016.
available at: https://CRAN.R-project.org/package=reticulate, R
package version 1.10, 2018b.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2958 L. J. Slater et al.: R in Hydrology

Bivand, R.: rgrass7: Interface Between GRASS 7 Geographical In- available at: https://CRAN.R-project.org/package=easyNCDF,
formation System and R, available at: https://CRAN.R-project. R package version 0.0.4, 2017.
org/package=rgrass7, R package version 0.1-12, 2018. Buytaert, W.: topmodel: Implementation of the Hydrological Model
Bivand, R. and Rundel, C.: rgeos: Interface to Geometry Engine – TOPMODEL in R, available at: https://CRAN.R-project.org/
Open Source (“GEOS”), available at: https://CRAN.R-project. package=topmodel, R package version 0.7.3, 2018.
org/package=rgeos, R package version 0.4-2, 2018. Ceola, S., Arheimer, B., Baratti, E., Blöschl, G., Capell, R., Castel-
Bivand, R., Pebesma, E., and Gomez-Rubio, V.: Applied spatial larin, A., Freer, J., Han, D., Hrachowitz, M., Hundecha, Y., Hut-
data analysis with R, Use R!, 2 edn., available at: http://www. ton, C., Lindström, G., Montanari, A., Nijzink, R., Parajka, J.,
asdar-book.org, Springer, New York, 2013. Toth, E., Viglione, A., and Wagener, T.: Virtual laboratories: new
Blondel, E.: geometa: Tools for Reading and Writing ISO/OGC opportunities for collaborative water science, Hydrol. Earth Syst.
Geographic Metadata, available at: https://CRAN.R-project.org/ Sci., 19, 2101–2117, https://doi.org/10.5194/hess-19-2101-2015,
package=geometa, R package version 0.4-0, 2018a. 2015.
Blondel, E.: ows4R: Interface to OGC Web-Services (OWS), avail- Chamberlain, S.: rnoaa: “NOAA” Weather Data from R, available
able at: https://CRAN.R-project.org/package=ows4R, R package at: https://CRAN.R-project.org/package=rnoaa, r package ver-
version 0.1-0, 2018b. sion 0.8.4, 2019.
Blöschl, G., Sivapalan, M., Savenije, H., Wagener, T., and Viglione, Chambers, J. M.: Programming with data: A guide to the S lan-
A.: Runoff prediction in ungauged basins: synthesis across pro- guage, Springer Science & Business Media, New York, USA,
cesses, places and scales, Cambridge University Press, Cam- 469 p., 1998.
bridge, 2013. Chambers, J. M.: Extending R, The R series, Chapman and
Blöschl, G., Hall, J., Parajka, J., Perdigão, R. A. P., Merz, B., Hall/CRC Press, Boca Raton, London, New York, 2016.
Arheimer, B., Aronica, G. T., Bilibashi, A., Bonacci, O., Borga, Chambers, J. M.: XRPython: Structured Interface to “Python”,
M., Čanjevac, I., Castellarin, A., Chirico, G. B., Claps, P., Fi- available at: https://CRAN.R-project.org/package=XRPython, r
ala, K., Frolova, N., Gorbachova, L., Gül, A., Hannaford, J., package version 0.8, 2017.
Harrigan, S., Kireeva, M., Kiss, A., Kjeldsen, T. R., Kohnová, Chambers, J. M.: XRJulia: Structured Interface to Julia, available at:
S., Koskela, J. J., Ledvinka, O., Macdonald, N., Mavrova- https://CRAN.R-project.org/package=XRJulia, R package ver-
Guirguinova, M., Mediero, L., Merz, R., Molnar, P., Montanari, sion 0.7.7, 2018.
A., Murphy, C., Osuch, M., Ovcharuk, V., Radevski, I., Rogger, Chan, C.-h., Chan, G. C. H., Leeper, T. J., and Becker, J.: rio:
M., Salinas, J. L., Sauquet, E., Šraj, M., Szolgay, J., Viglione, A Swiss-army knife for data file I/O, r package version 0.5.16,
A., Volpi, E., Wilson, D., Zaimi, K., and Živković, N.: Changing 2018.
climate shifts timing of European floods, Science, 357, 588–590, Chang, W. and Borges Ribeiro, B.: shinydashboard: Create Dash-
https://doi.org/10.1126/science.aan2506, 2017. boards with “Shiny”, available at: https://CRAN.R-project.org/
Blum, A. G., Archfield, S. A., and Vogel, R. M.: On the probabil- package=shinydashboard, r package version 0.7.1, 2018.
ity distribution of daily streamflow in the United States, Hydrol. Chang, W., Cheng, J., Allaire, J., Xie, Y., and McPherson, J.: Shiny:
Earth Syst. Sci., 21, 3093–3103, https://doi.org/10.5194/hess-21- web application framework for R, 2015.
3093-2017, 2017. Cheng, J., Karambelkar, B., and Xie, Y.: leaflet: Create Interactive
Boessenkool, B.: berryFunctions: Function Collection Related to Web Maps with the JavaScript “Leaflet” Library, available at:
Plotting and Hydrology, available at: https://CRAN.R-project. https://CRAN.R-project.org/package=leaflet, R package version
org/package=berryFunctions, R package version 1.17.0, 2018. 2.0.2, 2018.
Boessenkool, B., Harrigan, S., Smith, K., and Klotz, D.: Clark, M. P., Slater, A. G., Rupp, D. E., Woods, R. A., Vrugt, J. A.,
Using R in Hydrology, EGU2017 Short Course, Zenodo, Gupta, H. V., Wagener, T., and Hay, L. E.: Framework for Under-
https://doi.org/10.5281/zenodo.2554019, 2017. standing Structural Errors (FUSE): A modular framework to di-
Bond, N.: hydrostats: Hydrologic Indices for Daily Time Se- agnose differences between hydrological models, Water Resour.
ries Data, available at: https://CRAN.R-project.org/package= Res., 44, 12, 2008.
hydrostats, R package version 0.2.6, 2018. Coles, S.: An Introduction to Statistical Modeling of Extreme
Brenning, A., Bangs, D., and Becker, M.: RSAGA: SAGA Values, Springer Series in Statistics, available at: https://www.
Geoprocessing and Terrain Analysis, available at: https: springer.com/gp/book/9781852334598, Springer-Verlag, Lon-
//CRAN.R-project.org/package=RSAGA, R package version don, 2001.
1.3.0, 2018a. Conway, J., Eddelbuettel, D., Nishiyama, T., Prayaga, S. K., and
Brenning, A., Polakowski, F., and Becker, M.: RPyGeo: ArcGIS Tiffin, N.: RPostgreSQL: R Interface to the “PostgreSQL”
Geoprocessing via Python, available at: https://CRAN.R-project. Database System, available at: https://CRAN.R-project.org/
org/package=RPyGeo, R package version 1.0.0, 2018b. package=RPostgreSQL, R package version 0.6-2, 2017.
Brunsdon, C. and Comber, L.: An introduction to R Copernicus Climate Change Service: Climate Data Store, available
for spatial analysis and mapping, Sage, Los Ange- at: https://cds.climate.copernicus.eu, 2018.
les, available at: https://uk.sagepub.com/en-gb/eur/ Coron, L., Thirel, G., Delaigue, O., Perrin, C., and Andréas-
an-introduction-to-r-for-spatial-analysis-and-mapping/ sian, V.: The Suite of Lumped GR Hydrological Models
book241031, 2015. in an R package, Environ. Modell. Softw., 94, 166–171,
BSC-CNS and Manubens, N.: easyNCDF: Tools to Easily https://doi.org/10.1016/j.envsoft.2017.05.002, 2017.
Read/Write NetCDF Files into/from Multidimensional R Arrays, Coron, L., Perrin, C., Delaigue, O., Thirel, G., and Michel, C.:
airGR: Suite of GR Hydrological Models for Precipitation-

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2959

Runoff Modelling, available at: https://CRAN.R-project.org/ European Commission: Science with and for Society, avail-
package=airGR, R package version 1.0.10.11, 2018. able at: http://ec.europa.eu/research/participants/data/ref/h2020/
Crameri, F.: Geodynamic diagnostics, scientific visualisation wp/2018-2020/main/h2020-wp1820-swfs_en.pdf, 2015.
and StagLab 3.0, Geosci. Model Dev., 11, 2541–2562, Falcone, J.: GAGES-II: Geospatial Attributes of Gages for
https://doi.org/10.5194/gmd-11-2541-2018, 2018. Evaluating Streamflow, US Geological Survey, Reston, VA,
Csárdi, G. and Frick, H.: goodpractice: Advice on R Package https://doi.org/10.3133/70046617, 2011.
Building, available at: https://CRAN.R-project.org/package= Faria, J., Grosjean, P., and Jelihovschi, E.: Tinn-R-GUI/Editor for
goodpractice, r package version 1.0.2, 2018. R language and environment statistical computing, available at:
Csárdi, G.: rhub: Connect to “R-hub”, available at: https://CRAN. http://sourceforge.net/projects/tinn-r, 2008.
R-project.org/package=rhub, R package version 1.0.2, 2017. Federer, C.: BROOK90: a simulation model for evaporation, soil
Dee, D. P., Uppala, S. M., Simmons, A. J., Berrisford, P., Poli, water and streamflow, 1995.
P., Kobayashi, S., Andrae, U., Balmaseda, M. A., Balsamo, G., Fuka, D. R., Walter, M. T., Steenhuis, T. S., and Easton,
Bauer, P., Bechtold, P., Beljaars, A. C. M., van de Berg, L., Bid- Z. M.: SWATmodel: A multi-OS implementation of the
lot, J., Bormann, N., Delsol, C., Dragani, R., Fuentes, M., Geer, TAMU SWAT model, available at: https://CRAN.R-project.org/
A. J., Haimberger, L., Healy, S. B., Hersbach, H., Hólm, E. V., package=SWATmodel, r package version 0.5.9, 2014.
Isaksen, L., Kållberg, P., Köhler, M., Matricardi, M., McNally, Garnier, S.: viridis: Default Color Maps from “matplotlib”, avail-
A. P., Monge-Sanz, B. M., Morcrette, J.-J., Park, B.-K., Peubey, able at: https://CRAN.R-project.org/package=viridis, r package
C., de Rosnay, P., Tavolato, C., Thépaut, J.-N., and Vitart, F.: The version 0.5.1, 2018.
ERA-Interim reanalysis: Configuration and performance of the Gautier, L.: rpy2: Python interface to the R language (embedded R),
data assimilation system, Q. J. Roy. Meteor. Soc., 137, 553–597, available at: https://pypi.org/project/rpy2, python library version
https://doi.org/10.1002/qj.828, 2011. 2.9.5, 2018.
Delaigue, O., Coron, L., and Brigode, P.: airGRteaching: GDAL Development Team: GDAL – Geospatial Data Abstrac-
Teaching Hydrological Modelling with GR (Shiny Interface tion Library, Version 2.4.0, Open Source Geospatial Foundation,
Included), available at: https://CRAN.R-project.org/package= available at: https://www.gdal.org/, 2018.
airGRteaching, R package version 0.2.3.2, 2018a. Gesmann, M. and de Castillo, D.: googleVis: Interface between R
Delaigue, O., Thirel, G., Coron, L., and Brigode, P.: airGR and air- and the Google Visualisation API, The R Journal, 3, 40–44, 2011.
GRteaching: Two Open-Source Tools for Rainfall-Runoff Mod- Gilleland, E. and Katz, R. W.: extRemes 2.0: An Extreme
eling and Teaching Hydrology, in: HIC 2018. 13th International Value Analysis Package in R, J. Stat. Softw., 72, 1–39,
Conference on Hydroinformatics, edited by: Loggia, G. L., Freni, https://doi.org/10.18637/jss.v072.i08, 2016.
G., Puleo, V., and Marchis, M. D., vol. 3 of EPiC Series in Giraud, T. and Lambert, N.: cartography: Create and Integrate Maps
Engineering, 541–548, EasyChair, https://doi.org/10.29007/qsqj, in your R Workflow, Journal of Open Source Software, 4, 54,
2018b. https://doi.org/10.21105/joss.00054, 2016.
des Riviêres, J. and Wiegand, J.: Eclipse: A platform for integrating GRASS Development Team: Geographic Resources Analysis Sup-
development tools, IBM Syst. J., 43, 371–383, 2004. port System (GRASS GIS) Software, Open Source Geospatial
Do, H. X., Gudmundsson, L., Leonard, M., and Westra, S.: The Foundation, USA, available at: http://grass.osgeo.org/, 2019.
Global Streamflow Indices and Metadata Archive (GSIM) – Part Graul, C.: leafletR: Interactive Web-Maps Based on the Leaflet
1: The production of a daily streamflow archive and metadata, JavaScript Library, available at: http://cran.r-project.org/
Earth Syst. Sci. Data, 10, 765–785, https://doi.org/10.5194/essd- package=leafletR, R package version 0.4-0, 2016.
10-765-2018, 2018. Greenberg, J. A. and Mattiuzzi, M.: gdalUtils: Wrappers for the
Dowle, M. and Srinivasan, A.: data.table: Extension of Geospatial Data Abstraction Library (GDAL) Utilities, avail-
“data.frame”, available at: https://CRAN.R-project.org/ able at: https://CRAN.R-project.org/package=gdalUtils, R pack-
package=data.table, R package version 1.11.6, 2018. age version 2.0.1.14, 2018.
Eddelbuettel, D. and Balamuta, J. J.: Extending extitR with ex- Grothendieck, G. and Bellosta, C. J. G.: rJython: R interface to
titC++: A Brief Introduction to extitRcpp, PeerJ Preprints, 5, Python via Jython, available at: https://CRAN.R-project.org/
e3188v1, https://doi.org/10.7287/peerj.preprints.3188v1, 2017. package=rJython, r package version 0.0-4, 2012.
Emerson, J. W. and Kane, M. J.: biganalytics: Utilities for Guo, H.: Big Earth data: A new frontier in Earth
“big.matrix” Objects from Package “bigmemory”, available and information sciences, Big Earth Data, 1, 4–20,
at: https://CRAN.R-project.org/package=biganalytics, R pack- https://doi.org/10.1080/20964471.2017.1403062, 2017.
age version 1.1.14, 2016. Gupta, H. V., Perrin, C., Blöschl, G., Montanari, A., Kumar, R.,
ESRI: ArcGIS Desktop Release 10.6, Redlands, CA, Environmental Clark, M., and Andréassian, V.: Large-sample hydrology: a need
Systems Research Institute, ESRI Inc., 2018. to balance depth with breadth, Hydrol. Earth Syst. Sci., 18, 463–
Essawy, B., Goodall, J., Zell, W., Voce, D., Morsy, M., Sadler, J., 477, https://doi.org/10.5194/hess-18-463-2014, 2014.
Yuan, Z., and Malik, T.: Integrating scientific cyberinfrastruc- Guttag, J. V.: Introduction to computation and programming using
tures to improve reproducibility in computational hydrology: Python, MIT Press, Cambridge, MA, 2013.
Example for HydroShare and GeoTrust, Environ. Modell. Softw., Hafen, R. and Continuum Analytics, Inc.: rbokeh: R Interface
105, 217–229, https://doi.org/10.1016/j.envsoft.2018.03.025, for Bokeh, available at: https://CRAN.R-project.org/package=
2018. rbokeh, R package version 0.5.0, 2016.
Hall, D. K. and Riggs, G. A.: MODIS/Terra Snow Cover Daily L3
Global 0.05Deg CMG, Version 6, NASA National Snow and Ice

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2960 L. J. Slater et al.: R in Hydrology

Data Center Distributed Active Archive Center, Boulder, Col- Hurley, A., Slater, L., Thirel, G., Barker, L., Vitolo, C., Pros-
orado, USA, https://doi.org/10.5067/MODIS/MOD10C1.006, docimi, I., and Harrigan, S.: Using R in Hydrology at EGU2019,
2016. https://doi.org/10.5281/zenodo.3236979, 2019.
Hannah, D., Demuth, S., van Lanen, H., Looser, U., Prudhomme, Hutton, C., Wagener, T., Freer, J., Han, D., Duffy, C., and
C., Rees, G., Stahl, K., and Tallaksen, L.: Large-scale river Arheimer, B.: Most computational hydrology is not reproducible,
flow archives: importance, current status and future needs, Hy- so is it really science?, Water Resour. Res., 52, 7548–7555,
drol. Process., 25, 1191–1200, https://doi.org/10.1002/hyp.7794, https://doi.org/10.1002/2016WR019285, 2016.
2011. Iannone, R., Allaire, J., and Borges, B.: flexdashboard: R Mark-
Harrigan, S., Hannaford, J., Muchan, K., and Marsh, T. J.: Desig- down Format for Flexible Dashboards, available at: https:
nation and trend analysis of the updated UK Benchmark Net- //CRAN.R-project.org/package=flexdashboard, R package ver-
work of river flow stations: The UKBN2 dataset, Hydrol. Res., sion 0.5.1.1, 2018.
49, 552–567, 2018. Ihaka, R.: R: Past and future history, Computing Science and Statis-
Hart, E. M. and Bell, K.: prism: Download data from tics, 30, 392–396, 1998.
the Oregon prism project, R package version 0.0.6, Ihaka, R. and Gentleman, R.: R: a language for data analysis and
https://doi.org/10.5281/zenodo.33663, 2015. graphics, J. Comput. Graph. Stat., 5, 299–314, 1996.
Heinkel, R.: pyRserve: A Python client to remotely access the Kahle, D. and Wickham, H.: ggmap: Spatial Visualization with gg-
R statistic package via network, available at: https://pypi.org/ plot2, The R Journal, 5, 144–161, 2013.
project/pyRserve, python library version 0.9.1, 2017. Kane, M. J., Emerson, J., and Weston, S.: Scalable Strategies for
Heineman, G. T. and Councill, W. T.: Component-based soft- Computing with Massive Data, J. Stat. Softw., 55, 1–19, 2013.
ware engineering: putting the pieces together, Addison-Wesley, Keitt, T.: colorRamps: Builds color tables, available at: https:
Boston, London, xliii, 818 p., 2001. //CRAN.R-project.org/package=colorRamps, r package version
Hersbach, H., de Rosnay, P., Bell, B., Schepers, D., Simmons, 2.3, 2012.
A., Soci, C., Abdalla, S., Alonso-Balmaseda, M., Balsamo, G., Kelleher, C. and Wagener, T.: Ten guidelines for effective data visu-
Bechtold, P., Berrisford, P., Bidlot, J.-R., de Boisséson, E., alization in scientific publications, Environ. Modell. Softw., 26,
Bonavita, M., Browne, P., Buizza, R., Dahlgren, P., Dee, D., 822–827, 2011.
Dragani, R., Diamantakis, M., Flemming, J., Forbes, R., Geer, Kilibarda, M. and Bajat, B.: plotGoogleMaps: the R-based web-
A. J., Haiden, T., Hólm, E., Haimberger, L., Hogan, R., Horányi, mapping tool for thematic spatial data, GEOMATICA, 66, 37–
A., Janiskova, M., Laloyaux, P., Lopez, P., Munoz-Sabater, J., 49, 2012.
Peubey, C., Radu, R., Richardson, D., Thépaut, J.-N., Vitart, F., Knaus, J.: snowfall: Easier cluster computing (based on snow),
Yang, X., Zsótér, E., and Zuo, H.: Operational global reanalysis: available at: https://CRAN.R-project.org/package=snowfall, R
progress, future directions and synergies with NWP, ERA Report package version 1.84-6.1, 2015.
Series, available at: https://www.ecmwf.int/node/18765, 2018. Knuth, D. E.: Literate programming, Computer J., 27, 97–111,
Hester, J.: lintr: A “Linter” for R Code, available at: https://CRAN. 1984.
R-project.org/package=lintr, R package version 1.0.3, 2018. Koffler, D., Gauster, T., and Laaha, G.: lfstat: Calculation of Low
Hijmans, R. J.: raster: Geographic Data Analysis and Modeling, Flow Statistics for Daily Stream Flow Data, available at: https:
available at: https://CRAN.R-project.org/package=raster, r pack- //CRAN.R-project.org/package=lfstat, R package version 0.9.4,
age version 2.6-7, 2017. 2016.
Hirsch, R. M. and De Cicco, L. A.: User guide to Exploration and Kronenberg, R. and Oehlschlägel, L. M.: Implementation of the
Graphics for RivEr Trends (EGRET) and dataRetrieval: R pack- BROOK90 model in R, available at: https://github.com/rkronen/
ages for hydrologic data, chap. A10, U.S. Geological Survey, Re- Brook90_R, 2019.
ston, VA, available at: https://pubs.usgs.gov/tm/04/a10, 2015. Kuhn, M., Wing, J., Weston, S., Williams, A., Keefer, C., Engel-
Hosking, J. R. M.: Regional Frequency Analysis using L-Moments, hardt, A., Cooper, T., Mayer, Z., Kenkel, B., the R Core Team,
available at: https://CRAN.R-project.org/package=lmomRFA, R Benesty, M., Lescarbeau, R., Ziem, A., Scrucca, L., Tang,
package, version 3.2, 2019a. Y., Candan, C., and Hunt, T.: caret: Classification and Re-
Hosking, J. R. M.: L-Moments, R package, version 2.8, 2019b. gression Training, available at: https://CRAN.R-project.org/
Hufkens, K.: ecmwfr: Interface to the public “ECMWF” Web Ser- package=caret, R package version 6.0-81, 2018.
vices, available at: https://github.com/khufkens/ecmwfr, R pack- Kunst, J.: highcharter: A Wrapper for the “Highcharts” Library,
age version 0.0.2, 2018. available at: https://CRAN.R-project.org/package=highcharter,
Hufkens, K., Basler, D., Milliman, T., Melaas, E. K., and Richard- R package version 0.5.0, 2017.
son, A. D.: An integrated phenology modelling framework in Lawrence, M. and Wickham, H.: plumbr: Mutable and dynamic data
R: modelling vegetation phenology with phenor, Methods Ecol. models, RStudio, R package, version 0.6.9, available at: http://
Evol., 9, 1–10, https://doi.org/10.1111/2041-210X.12970, 2018. CRAN.R-project.org/package=plumbr, 2018.
Hunt, T.: ModelMetrics: Rapid Calculation of Model Metrics, avail- LeDell, E., Gill, N., Aiello, S., Fu, A., Candel, A., Click, C., Kralje-
able at: https://CRAN.R-project.org/package=ModelMetrics, r vic, T., Nykodym, T., Aboyoun, P., Kurka, M., and Malohlava,
package version 1.2.2, 2018. M.: h2o: R Interface for “H2O”, available at: https://CRAN.
Hurley, A.: Processing, modelling and visualizing R-project.org/package=h2o, R package version 3.20.0.8, 2018.
hydrological data in R (Version 1.1.1), Zenodo, Li, C.: JuliaCall: Seamless Integration Between R and “Julia”, avail-
https://doi.org/10.5281/zenodo.2553998, 2018. able at: https://CRAN.R-project.org/package=JuliaCall, R pack-
age version 0.16.0, 2018.

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2961

Light, A. and Bartlein, P. J.: The end of the rainbow? Color schemes across the US Midwest, Adv. Water. Resour., 127, 225–236,
for improved data graphics, Eos, Transactions American Geo- https://doi.org/10.1016/j.advwatres.2019.03.019, 2019.
physical Union, 85, 385–391, 2004. Neuwirth, E.: RColorBrewer: ColorBrewer Palettes, available at:
Lovelace, R., Nowosad, J., and Münchow, J.: Geocomputation with https://CRAN.R-project.org/package=RColorBrewer, r package
R, Chapman and Hall/CRC Press, Boca Raton, London, New version 1.1-2, 2014.
York, available at: https://geocompr.robinlovelace.net/, 2019. Ooms, J.: The OpenCPU system: Towards a universal interface
Luraschi, J. and Allaire, J.: r2d3: Interface to “D3” Visualizations, for scientific computing through separation of concerns, arXiv
available at: https://CRAN.R-project.org/package=r2d3, R pack- preprint arXiv:1406.4806, 2014.
age version 0.2.3, 2018. Ooms, J.: V8: Embedded JavaScript Engine for R, available at:
Luraschi, J., Kuo, K., Ushey, K., Allaire, J., and The Apache Soft- https://CRAN.R-project.org/package=V8, 2017.
ware Foundation: sparklyr: R Interface to Apache Spark, avail- Ooms, J.: hunspell: High-Performance Stemmer, Tokenizer,
able at: https://CRAN.R-project.org/package=sparklyr, R pack- and Spell Checker, available at: https://CRAN.R-project.org/
age version 0.9.3, 2018. package=hunspell, r package version 3.0, 2018.
MathWorks: Company Overview, available at: https: Openshaw, S. and Abrahart, R. J.: GeoComputation, vol. 24, Taylor
//www.mathworks.com/content/dam/mathworks/tag-team/ & Francis, London, New York, 2000.
Objects/c/company-fact-sheet-8282v18.pdf, 2018. Pebesma, E.: Simple Features for R: Standardized Support for Spa-
McKiernan, E., Bourne, P., Brown, C., Buck, S., Kenall, A., tial Vector Data, The R Journal, available at: https://journal.
Lin, J., McDougall, D., Nosek, B., Ram, K., Soderberg, C., r-project.org/archive/2018/RJ-2018-009/index.html, 2018a.
Spies, J., Thaney, K., Updegrove, A., Woo, K., and Yarkoni, Pebesma, E.: stars: Scalable, Spatiotemporal Tidy Arrays, avail-
T.: How open science helps researchers succeed, eLife, 5, 1–19, able at: https://CRAN.R-project.org/package=stars, R package
https://doi.org/10.7554/eLife.16800, 2016. version 0.2-0, 2018b.
Melsen, L., Torfs, P., Uijlenhoet, R., and Teuling, A.: Comment on Pebesma, E. and Bivand, R.: Classes and methods for spatial data
“Most computational hydrology is not reproducible, so is it really in R, R News, 5, 9–13, 2005.
science?” by Christopher Hutton et al., Water Resour. Res., 53, Pebesma, E., Nüst, D., and Bivand, R.: The R software environment
2568–2569, https://doi.org/10.1002/2016WR020208, 2017. in reproducible geoscientific research, Eos, Transactions Ameri-
Metcalfe, P., Beven, K., and Freer, J.: Dynamic TOPMODEL: can Geophysical Union, 93, 163–163, 2012.
A new implementation in R and its sensitivity to time Pedersen, T. L.: gganimate: Create easy animations with ggplot2,
and space steps, Environ. Modell. Softw., 72, 155–172, available at: https://github.com/thomasp85/gganimate, 2018.
https://doi.org/10.1016/j.envsoft.2015.06.010, 2015. Perkel, J. M.: A toolkit for data transparency takes shape, Na-
Metcalfe, P., Beven, K., and Freer, J.: dynatopmodel: Implemen- ture, 560, 513–515, https://doi.org/10.1038/d41586-018-05990-
tation of the Dynamic TOPMODEL Hydrological Model, avail- 5, 2018.
able at: https://CRAN.R-project.org/package=dynatopmodel, R Perrin, C., Michel, C., and Andréassian, V.: Improvement of a parsi-
package version 1.2.1, 2018. monious model for streamflow simulation, J. Hydrol., 279, 275–
Microsoft and Weston, S.: foreach: Provides Foreach Looping Con- 289, https://doi.org/10.1016/S0022-1694(03)00225-7, 2003.
struct for R, available at: https://CRAN.R-project.org/package= Pierce, D.: ncdf4: Interface to Unidata netCDF (Version 4 or Ear-
foreach, R package version 1.4.4, 2017. lier) Format Data Files, available at: https://CRAN.R-project.
Microsoft Corporation and Weston, S.: doParallel: Foreach Par- org/package=ncdf4, R package version 1.16, 2017.
allel Adaptor for the “parallel” Package, available at: https: Pohlert, T.: trend: Non-Parametric Trend Tests and Change-Point
//CRAN.R-project.org/package=doParallel, R package version Detection, available at: https://CRAN.R-project.org/package=
1.0.14, 2018. trend, R package version 1.1.1, 2018.
Muenchow, J., Schratz, P., and Brenning, A.: RQGIS: Integrat- QGIS Development Team: QGIS Geographic Information System,
ing R with QGIS for Statistical Geocomputing, The R Journal, Open Source Geospatial Foundation Project, available at: http:
9, 409–428, available at: https://rjournal.github.io/archive/2017/ //qgis.osgeo.org, 2018.
RJ-2017-067/RJ-2017-067.pdf, 2017. R Core Team: R: A Language and Environment for Statistical Com-
Müller, K., Wickham, H., James, D. A., and Falcon, S.: RSQLite: puting, R Foundation for Statistical Computing, Vienna, Austria,
“SQLite” Interface for R, available at: https://CRAN.R-project. available at: http://www.R-project.org, 2018.
org/package=RSQLite, R package version 2.1.1, 2018. Rigby, R. A. and Stasinopoulos, D. M.: Generalized additive models
Neil, D.: Modern Vim: Craft Your Development Environment for location, scale and shape, with discussion, Applied Statistics,
with Vim 8 and Neovim, Pragmatic Bookshelf, avail- 54, 507–554, 2005.
able at: https://www.oreilly.com/library/view/modern-vim/ Ritchie, D. M.: The development of the C language, ACM Sigplan
9781680506006/?ar, 2018. Notices, 28, 201–208, 1993.
Neistsch, S. L., Arnold, J. G., Kiniry, J. R., and Williams, Rödiger, S., Friedrichsmeier, T., Kapat, P., Michalke, M.: RKWard:
J. R.: “Soil Water Assessment Tool Theoretical Documentation a comprehensive graphical user interface and integrated develop-
(version 2005)”, available at: https://swat.tamu.edu/media/1290/ ment environment for statistical analysis with R, J. Stat. Softw.,
swat2000theory.pdf, Grassland Soil and Water Research Labora- 49, 1–34, 2012.
tory, Temple, Texas, 2005. Rossini, A. J., Heiberger, R. M., Sparapani, R. A., Maechler, M.,
Neri, A., Villarini, G., Slater, L. J., and Napolitano, F.: On and Hornik, K.: Emacs speaks statistics: A multiplatform, mul-
the statistical attribution of the frequency of flood events tipackage development environment for statistical analysis, J.
Comput. Graph. Stat., 13, 247–261, 2004.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019


2962 L. J. Slater et al.: R in Hydrology

RStudio Team: RStudio: Integrated Development Environment for ries Charting Library, available at: https://CRAN.R-project.org/
R, RStudio, Inc., Boston, MA, available at: http://www.rstudio. package=dygraphs, R package version 1.1.1.6, 2018.
com/, 2018. Vantas, K.: hydroscoper: R interface to the Greek National
Ryberg, K. R. and Vecchia, A. V.: waterData: Retrieval, Analysis, Data Bank for Hydrological and Meteorological Infor-
and Anomaly Calculation of Daily Hydrologic Time Series Data, mation, The Journal of Open Source Software, 3, 1–7,
available at: https://CRAN.R-project.org/package=waterData, R https://doi.org/10.21105/joss.00625, 2018.
package version 1.0.8, 2017. Viglione, A.: nsRFA: Non-Supervised Regional Frequency Analy-
SAGA Development Team: System for Automated Geoscientific sis, available at: https://CRAN.R-project.org/package=nsRFA, r
Analyses (SAGA GIS), Germany, available at: http://www. package version 0.7-14, 2018.
saga-gis.org/, 2008. Viglione, A. and Parajka, J.: TUWmodel: Lumped/Semi-
Sanner, M. F.: Python: a programming language for software in- Distributed Hydrological Model for Educational Purposes,
tegration and development, J. Mol. Graph. Model., 17, 57–61, R package version 1.0-2, 2019.
1999. Villarini, G., Serinaldi, F., Smith, J. A., and Krajewski, W. F.: On the
Sarkar, D.: Lattice: Multivariate Data Visualization with R, Use R!, stationarity of annual flood peaks in the continental United States
Springer, New York, available at: http://lmdvr.r-forge.r-project. during the 20th century, Water Resour. Res., 45, 1–17, 2009.
org, 2008. Vitolo, C.: hddtools: Hydrological Data Discovery
Schmidt-Walter, P.: brook90r, https://doi.org/10.5281/zenodo.1433677, Tools, The Journal of Open Source Software, 2, 56,
2018. https://doi.org/10.21105/joss.00056, 2017.
Sievert, C.: plotly for R, available at: https://plotly-book.cpsievert. Vitolo, C., Fry, M., and Buytaert, W.: rnrfa: An R package to Re-
me, 2018. trieve, Filter and Visualize Data from the UK National River
Slater, L., Harrigan, S., Gauster, T., Hurley, A., Thirel, G., and Vi- Flow Archive, The R Journal, 8, 102–116, 2016a.
tolo, C.: Using R in Hydrology, EGU2018 Short Course, Zenodo, Vitolo, C., Wells, P., Dobias, M., and Buytaert, W.: fuse: An R pack-
https://doi.org/10.5281/zenodo.2554009, 2018. age for ensemble Hydrological Modelling, The Journal of Open
Slater, L. J., Singer, M. B., and Kirchner, J. W.: Hydrologic ver- Source Software, 1, 52, https://doi.org/10.21105/joss.00052,
sus geomorphic drivers of trends in flood hazard, Geophys. 2016b.
Res. Lett., 42, 370–376, https://doi.org/10.1002/2014GL062482, Wahlbrink, S.: Eclipse Plug-In for R: StatET [Software], 2016.
2015. Wendt, N.: gribr: R interface for GRIB files using ECMWF ec-
Sommerlot, A., Fuka, D., and Easton, Z.: getMet: Get Meteoro- Codes, available at: https://github.com/nawendt/gribr, r package
logical Data for Hydrologic Models, available at: https://CRAN. version 1.2.2, 2018.
R-project.org/package=getMet, R package version 0.3.2, 2016. Wickham, H.: testthat: Get Started with Testing, The R Journal, 3,
Souza, R.: Ecohydmod: Ecohydrological Modelling, available 5–10, 2011.
at: https://CRAN.R-project.org/package=Ecohydmod, R pack- Wickham, H.: R packages: organize, test, document, and share your
age version 1.0.0, 2017. code, O’Reilly Media, Sebastopol, available at: http://r-pkgs.had.
Stauffer, R., Mayr, G. J., Dabernig, M., and Zeileis, A.: Somewhere co.nz, 2015.
over the rainbow: How to make effective use of colors in mete- Wickham, H.: feather: R Bindings to the Feather “API”, available
orological visualizations, B. Am. Meteorol. Soc., 96, 203–216, at: https://CRAN.R-project.org/package=feather, R package ver-
2015. sion 0.3.1, 2016a.
Tapley, B. D., Bettadpur, S., Ries, J. C., Thompson, P. F., Wickham, H.: ggplot2: Elegant Graphics for Data Analysis, Use R!,
and Watkins, M. M.: GRACE measurements of mass Springer, New York, available at: http://ggplot2.org, 2016b.
variability in the Earth system, Science, 305, 503–505, Wickham, H.: tidyverse: Easily Install and Load the “Tidyverse”,
https://doi.org/10.1126/science.1099192, 2004. available at: https://CRAN.R-project.org/package=tidyverse, R
Tennekes, M.: tmap: Thematic Maps in R, J. Stat. Softw., 84, 1–39, package version 1.2.1, 2017.
https://doi.org/10.18637/jss.v084.i06, 2018. Wickham, H. and Hesselberth, J.: pkgdown: Make Static HTML
Thieurmel, B., Marcelionis, A., Petit, J., Salette, E., and Robert, Documentation for a Package, available at: https://CRAN.
T.: rAmCharts: JavaScript Charts Tool, available at: https:// R-project.org/package=pkgdown, R package version 1.3.0,
CRAN.R-project.org/package=rAmCharts, R package version 2018.
2.1.9, 2018. Wickham, H., Danenberg, P., and Eugster, M.: roxygen2: In-Line
Tuszynski, J.: caTools: Tools: moving window statistics, GIF, Documentation for R, available at: https://CRAN.R-project.org/
Base64, ROC AUC, etc., available at: https://CRAN.R-project. package=roxygen2, r package version 6.1.1, 2018a.
org/package=caTools, R package version 1.17.1.1, 2018. Wickham, H., Hester, J., and Francois, R.: readr: Read Rectangular
Urbanek, S.: proj4: A simple interface to the PROJ.4 cartographic Text Data, available at: https://CRAN.R-project.org/package=
projections library, available at: https://CRAN.R-project.org/ readr, r package version 1.3.1, 2018b.
package=proj4, R package version 1.0-8, 2012. Wilby, R. L., Clifford, N. J., De Luca, P., Harrigan, S., Hillier, J.
Urbanek, S.: rJava: Low-Level R to Java Interface, available at: K., Hodgkins, R., Johnson, M. F., Matthews, T. K. R., Murphy,
https://CRAN.R-project.org/package=rJava, R package version C., Noone, S. J., Parry, S., Prudhomme, C., Rice, S. P., Slater, L.
0.9-10, 2018. J., Smith, K. A., and Wood, P. J.: The “dirty dozen” of freshwa-
Vanderkam, D., Allaire, J., Owen, J., Gromer, D., and Thieurmel, ter science: detecting then reconciling hydrological data biases
B.: dygraphs: Interface to “Dygraphs” Interactive Time Se- and errors, Wiley Interdisciplinary Reviews: Water, 4, e1209,
https://doi.org/10.1002/wat2.1209, 2017.

Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019 www.hydrol-earth-syst-sci.net/23/2939/2019/


L. J. Slater et al.: R in Hydrology 2963

Wilkinson, L.: The Grammar of Graphics, Statistics and Comput- Xie, Y. and Lesur, R.: pagedown: Paginate the HTML Output of
ing, 1st edn., Springer, New York, 1999. R Markdown with CSS for Print, available at: https://CRAN.
Wilson, G.: Software carpentry: getting scientists to write better R-project.org/package=pagedown, r package version 0.1, 2019.
code by making them more productive, Comput. Sci. Eng., 8, Xie, Y., Hill, A. P., and Thomas, A.: blogdown: Creating Websites
66–69, 2006. with R Markdown, The R series, Chapman and Hall/CRC Press,
Wilson, G.: Software Carpentry: lessons learned, F1000Research, Boca Raton, London, New York, available at: https://github.com/
3, available at: https://software-carpentry.org/lessons, 2014. rstudio/blogdown, 2017.
Winslow, L. A., Hahn, T. H., Princiotta, S. D., Leach, T. H. and Yee, T. W., Stoklosa, J., and Huggins, R. M.: The VGAM Package
Rose, K. C.: Characterizing hydrologic networks: Developing a for Capture-Recapture Data Using the Conditional Likelihood,
tool to enable research of macroscale aquatic networks, Environ. J. Stat. Softw., 65, 1–33, https://doi.org/10.18637/jss.v065.i05,
Modell. Softw., 104, 94–101, 2018. 2015.
WMO: Manual on low flow estimation and prediction, Geneva, Zambrano-Bigiarini, M.: hydroGOF: Goodness-of-fit functions for
2009. comparison of simulated and observed hydrological time series,
Wood, S. N.: Generalized additive models: an introduction with R, https://doi.org/10.5281/zenodo.840087, R package version 0.3-
Texts in statistical science, 2nd edn., Chapman and Hall/CRC 10, 2017a.
Press, Boca Raton, London, New York, 2017. Zambrano-Bigiarini, M.: hydroTSM: Time Series Manage-
Xie, Y.: bookdown: Authoring Books and Technical Documents ment, Analysis and Interpolation for Hydrological Modelling,
with R Markdown, The R series, available at: https://github.com/ https://doi.org/10.5281/zenodo.839864, R package version 0.5-
rstudio/bookdown, Chapman and Hall/CRC Press, Boca Raton, 1, 2017b.
London, New York, 2016. Zeileis, A., Fisher, J. C., Hornik, K., Ihaka, R., McWhite, C. D.,
Xie, Y.: knitr: A General-Purpose Package for Dynamic Report Murrell, P., Stauffer, R., and Wilke, C. O.: colorspace: A Tool-
Generation in R, available at: https://yihui.name/knitr, R pack- box for Manipulating and Assessing Colors and Palettes, arXiv
age version 1.20, 2018. 1903.06490, arXiv.org E-Print Archive, available at: http://arxiv.
org/abs/1903.06490, 2019.

www.hydrol-earth-syst-sci.net/23/2939/2019/ Hydrol. Earth Syst. Sci., 23, 2939–2963, 2019

You might also like