using r in hydrology: a review of recent developments and ... · 1 introduction: the rapid rise of...

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

Upload: others

Post on 04-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

Hydrol Earth Syst Sci 23 2939ndash2963 2019httpsdoiorg105194hess-23-2939-2019copy Author(s) 2019 This work is distributed underthe Creative Commons Attribution 40 License

Using R in hydrology a review of recent developmentsand future directionsLouise J Slater1 Guillaume Thirel2 Shaun Harrigan3 Olivier Delaigue2 Alexander Hurley4 Abdou Khouakhi5Ilaria Prosdocimi6 Claudia Vitolo3 and Katie Smith7

1School of Geography and the Environment University of Oxford Oxford OX1 3QY UK2HYCAR Research Unit IRSTEA 1 Rue Pierre-Gilles de Gennes 92160 Antony France3Forecast Department European Centre for Medium-Range Weather Forecasts (ECMWF)Shinfield Park Reading RG2 9AX UK4School of Geography Earth and Environmental Sciences University of Birmingham Birmingham B15 2TT UK5School of Architecture Building and Civil Engineering Loughborough University Loughborough LE11 3TU UK6Department of Environmental Sciences Informatics and Statistics Carsquo Foscari University of Venice 30172 Venice Italy7Centre for Ecology amp Hydrology Maclean Building Crowmarsh Gifford Wallingford OX10 8BB UK

Correspondence Louise J Slater (louiseslaterouceoxacuk)

Received 31 January 2019 ndash Discussion started 18 February 2019Revised 4 June 2019 ndash Accepted 14 June 2019 ndash Published 12 July 2019

Abstract The open-source programming language R hasgained a central place in the hydrological sciences overthe last decade driven by the availability of diverse hydro-meteorological data archives and the development of open-source computational tools The growth of Rrsquos 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 eventsIn this paper we explore the benefits and advantages ofRrsquos usage in hydrology such as the democratization of datascience and numerical literacy the enhancement of repro-ducible research and open science the access to statisticaltools the ease of connecting R to and from other languagesand the support provided by a growing community This pa-per provides an overview of a typical hydrological work-flow based on reproducible principles and packages for re-trieval of hydro-meteorological data spatial analysis hydro-logical modelling statistics and the design of static and dy-namic visualizations and documents We discuss some of thechallenges that arise when using R in hydrology and use-ful tools to overcome them including the use of hydrologi-cal libraries documentation and vignettes (long-form guidesthat illustrate how to use packages) the role of integrated de-velopment environments (IDEs) and the challenges of bigdata and parallel computing in hydrology Lastly this paperprovides a roadmap for Rrsquos future within hydrology withR packages as a driver of progress in the hydrological sci-

ences application programming interfaces (APIs) providingnew avenues for data acquisition and provision enhancedteaching of hydrology in R and the continued growth of thecommunity via short courses and events

1 Introduction the rapid rise of R in hydrology

In recent decades the hydrological sciences like many otherdisciplines have witnessed major changes due to the growthof diverse data archives and the development of computa-tional resources Hydrology has benefited from the increasein publicly accessible data including (a) observational riverflow archives (Hannah et al 2011) such as the World Mete-orological Organizationrsquos Global Runoff Data Centre whichcurrently includes more than 9500 stations from 161 coun-tries (b) gridded reanalysis climate data products such asCopernicusrsquos ERA-Interim (Dee et al 2011) or ERA5 (Hers-bach et al 2018 Copernicus Climate Change Service2018) (c) measurements from sensors and satellites such astotal water storage variations from the Gravity Recovery andClimate Experiment (GRACE Tapley et al 2004) or snowcover area from NSIDC MODIS (Hall and Riggs 2016) and(d) catchment attributes such as the Global Streamflow In-dices and Metadata Archive (Do et al 2018) or nationaldatasets 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 facilitatedthe investigation of many catchments as well as interdisci-plinary research linking meteorology climatology hydrol-ogy and the earth sciences

In addition to the availability of large-scale data archivesthe increase in computational power and uptake of program-ming languages have also been a major driver of change inthe discipline Increasingly hydrologists are using data sci-ence approaches to derive process insights from large andcomplex datasets (eg Guo 2017) The ability to explore andmine these datasets has facilitated a move from in-depth ex-periments in single catchments towards large-sample studies(eg Villarini et al 2009 Berghuijs et al 2014 Slater et al2015 Archfield et al 2016 Bloumlschl et al 2017 Blum et al2017 Harrigan et al 2018) By applying an analysis to manycatchments or grouping those with similar characteristicshydrologists have been able to test the broad applicabilityof hydrological theories and draw systematic insights abouthydrological processes (eg Bloumlschl et al 2013) Large-sample studies are increasingly being employed to developnovel (conceptual andor physical) models that are applica-ble across diverse catchment conditions thereby improvingprocess understanding and leading to more robust predictions(eg Gupta et al 2014) At the same time a broad rangeof well-established lumped (eg GR4J Perrin et al 2003)and semi-distributed (eg TOPMODEL Beven 1997) mod-els of the hydrological cycle ndash many of which were initiallydeveloped in older languages such as Fortran ndash have nowbeen incorporated into R packages Some of them have beentranslated into R and others remain in their initial languageseg SWAT (Neistsch et al 2005) The uptake of empiricalconceptual and physically based computational hydrologi-cal models as well as the growth of large-sample studieshave driven the emergence of a field that can be describedas computational hydrology (eg Hutton et al 2016 Melsenet al 2017) a scientific paradigm that allows hydrologiststo explore hydrological questions with a computational ap-proach Computational hydrology aims to develop repro-ducible hydrological analyses that can be applied to manycatchments with the aim of generating novel and system-atic process insights that improve our physical understandingof the hydrological cycle The field differs somewhat fromboth hydroinformatics (eg Abbott et al 1991) which has agreater focus on information and communication technolo-gies andor black-box approaches to address water-relatedissues and geocomputation (eg Openshaw and Abrahart2000 Lovelace et al 2019) which uses similar computa-tional techniques for spatial data analysis

The growth of computational hydrology has been en-hanced by the development of the open-source program-ming language R originally developed for statistical com-puting by Ross Ihaka and Robert Gentleman in the 1990s(Ihaka and Gentleman 1996 R Core Team 2018) and sup-ported by an enthusiastic and rapidly growing online com-munity As a free multiplatform language R is highly ver-

satile and has a wide range of uses including data acqui-sition and provisioning manipulation analysis modellingstatistics visualization and even well-developed geospatialand geographic information system (GIS) applications Rcan be used for generating reports making interactive pre-sentations for teaching or conferences or even prototyp-ing dashboards and web applications One of the greateststrengths of R is its extremely active community of userswho in the past 25 years have developed and released in thepublic domain more than 14 000 packages spanning manyscientific disciplines The Comprehensive R Archive Net-work (CRAN httpscranr-projectorg) is the main repos-itory for these packages hosted by a network of FTP andweb servers around the world The abrupt increase in thenumber of hydrological package updates in 2018ndash2019 ex-emplifies the growing importance of the language in hydrol-ogy and strengthening of the community (Fig 1) These de-velopments have allowed the R language to fit comfortablyin production-ready ecosystems (eg web applications) andtake advantage of cutting-edge technologies and tools for im-proving reproducibility testing and continuous integration

This paper aims to provide a broad overview of the utilityof R in the hydrological sciences and of important develop-ments in recent years In Sect 2 we provide a summary ofthe many benefits and advantages of using R in hydrology InSect 3 we describe some of the key hydrological packagesthat have been developed by the community as well as gen-eral packages of broad application in the sciences In Sect 4we discuss some of the challenges that the hydrologic R users(R-Hydro) community faces including tools and solutions toovercome these challenges Finally in Sect 5 we list some ofthe future directions to strengthen the computational hydrol-ogy community

2 The benefits and advantages of using R in hydrology

21 Democratizing open science and numerical literacy

One of the principal advantages of R is its ease of use result-ing from typically detailed documentation a large numberof online resources object-oriented programming (the lan-guage is organized around objects with unique attributes)functional programming (the code can be written with func-tions to facilitate modularity and avoid changing-state data)and the availability of the source code under the open-sourcelicense Further R can be run on all major operating sys-tems (ie Microsoft Windows macOS and Linux) makingit ideal for institutional or personal use In contrast with com-piled languages such as C or Fortran R is an interpretedlanguage which means that the code can be written and ex-ecuted line by line In practice this means that achieving abasic hydrological analysis can be as simple as writing a se-quence of commands for reading a file cleaning the data andplotting a graph These sequences of commands are typically

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2941

Figure 1 The number of R packages available on CRAN (1997ndash2019) All packages are shown in (a) and hydrology packages only (definedas those that include the string ldquohydrordquo 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 httpscranr-projectorgsrccontribArchive) and (2) date of last publication ndash ie most recent publication date of packages that are currently available on CRAN(black bars httpscranr-projectorgwebpackagesavailable_packages_by_datehtml) In both cases each package is counted only once forexample the package hydroTSM was first released in 2010 (grey) but its most recent update was in 2017 (black) The script to produce thisfigure 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-stitute a hydrological workflow (see Fig 3) A high level ofdocumentation and support exists for each of the tasks withina hydrological workflow including a diverse range of pack-ages (see Sect 3) R users may search for R-relevant con-tent (such as expressions packages and functions) using thededicated Internet search engine RSeek (httpsrseekorg)as well as generalist search engines For many R newcomersthe initial hurdle is finding the time required to gain a basicunderstanding of R itself but these efforts pay off rapidly asone learns how to find solutions on the Internet (see Sect 25)and to navigate help files provided within R

One of the advantages of writing a script is that it canbe reused and improved incrementally over time so that theauthor never has to repeat a task manually (in contrast topoint-and-click software that lacks a programmatic inter-face) Moreover the same script can be reused repeatedly bydifferent people to reproduce a given result (avoiding dupli-cation of efforts) or to analyse different data eg differentcatchments different types of gridded data or the same dataat different points in time Thus scripts written in R (or otherlanguages) have wide-ranging benefits as they facilitate thetesting and quality control of the scientific workflow can beshared and improved by a team of users lessen the risk ofmaking manual mistakes and significantly enhance the speedwith which analyses can be conducted and updated

Recent developments in R have contributed to enhancingopen science and numerical literacy in the hydrological sci-ences Rrsquos ease of access and use has improved what mightbe termed ldquoscientific computing literacyrdquo within the hydro-logical community Volunteer projects such as the SoftwareCarpentry (Wilson 2006 2014) have been teaching basic

computing skills to researchers since 1998 and R now formsa central part of their training Over the past decade or soR has become one of the core tools for scientific compu-tation in hydrology Hosted instances of R allow the userto run R and RStudioreg (an integrated development environ-ment ndash IDE described in greater detail in Sect 42) in thecloud ie in a web browser rather than locally on onersquos owncomputer These hosted instances have made the languagemore accessible to non-specialists due to the large rangeof pre-installed packages Importantly the RStudio Cloud(httpsrstudiocloud) has recently been developed to makeit easy for professionals hobbyists trainers teachers andstudents to do share teach and learn data science using Rand provides many learning materials including interactivetutorials covering the basics of data science cheat sheets forworking with popular R packages and a guide to using RStu-dio Cloud Such hosted instances of R remove the initial hur-dle of installing R and the required packages (ie the techni-calities) and ultimately make scientific work more accessible

The R-Hydro community has developed a number of plat-forms to share computational hydrology analyses and codeis increasingly being shared via repositories (see Sect 51)Code and results can be published as traditional media (egas articles supplemental material scripts packages or com-putational environments) or on the web via blog posts snip-pets or tutorial documents allowing users to engage inter-actively The ldquoliterate programmingrdquo paradigm (ie inter-spersing snippets of code and written text within a uniquedocument see Knuth 1984) has also become increasinglypopular due to the development of dashboards and onlinepublishing platforms Dashboards are interfaces that may in-clude a group of related data visualizations such as charts

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 indicatedin coloured text these packages are described in further detail in Sect 31 to Sect 38

graphs tables and maps (eg Fig 6) They can be fixed(eg a non-interactive web page) or dynamic (eg allow-ing users to alter input values and see how outputs changevirtually in real time) Hydrologists have increasingly em-ployed dashboards to display their analyses in an interac-tive user-friendly manner using packages such as plotlya graphing library that makes publication-quality graphsonline (Sievert 2018) the shiny web application frame-work (Chang et al 2015) shinydashboard (Chang andBorges Ribeiro 2018) or the flexdashboard package(Iannone et al 2018) Additionally free services such asRPubs (a free web-publishing platform httpsrpubscom)and the aforementioned plotly enable the publishing ofthese static or interactive documents and visualizations on-line In doing so these publishing services facilitate immedi-ate interaction and knowledge transfer

22 Enhancing reproducible hydrological research andopen science

Reproducibility is a key feature of the scientific method andcan be broadly defined as the ability for the community to

reproduce and verify previous findings Encouraging repro-ducible practices helps reduce the likelihood of errors (meth-ods can be tested by other researchers) while increasing theuptake of any positive developments within a discipline (Hut-ton et al 2016) However scientific research is increasinglyunder fire for its lack of reproducibility due to an inadequatemethodology description (Ceola et al 2015) and model anddata availability True reproducibility requires more than themere repeatability of results with the same computer codeand data one must also be able to reproduce a studyrsquos con-clusions when testing the theory with different data or a dif-ferent model set-up (Melsen et al 2017)

The open-source nature of R packages and the CRANrepository set-up are one key added value of R to repro-ducible geoscientific research (Pebesma et al 2012) TheCRAN repository ensures the traceability of past analy-ses by archiving former versions of the packages com-piled on any platform (httpscranr-projectorg) In addi-tion packages are citeable in reports and papers togetherwith their version number allowing the user to track whichcode was used The package developers are also ldquotrace-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 theuser to split a dataset by categories (rows and columns) Here a probabilistic time-series GAMLSS model of flood frequency at one gaugingstation in Ohio USA is shown for four different seasons (rows) and two peak-over-threshold quantities (columns two to four peaks peryear) The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon) and the observed values are plotted in theforeground as grey circles (geom_point) Source Neri et al (2019)

ablerdquo on the CRAN via their ORCID (Open Research andContributor ID) number which provides an indication ofwhether they also authored any corresponding scientific pa-pers The CRAN Task Views provide guides to the pack-ages and tools that exist on CRAN for the different dis-ciplines Note that many packages are submitted to onlinerepositories such as GitHub that never make it to CRANfor a range of reasons but this does not necessarily makethem less reliable The Task Views provide a list of toolswhich can enhance reproducibility in R (see httpscranr-projectorgwebviewsReproducibleResearchhtml) Rely-ing on well-established publishing platforms such as CRANand GitHub has promoted the use of best practice in writ-ing R code Packages such as rhub (Csaacuterdi 2017) pro-vide code checks for packages on certain operating systemswhile roxygen2 helps users create documentation for theirR packages (Wickham et al 2018a) Other initiatives suchas rOpenSci (carefully vetted scientific R software tools seehttpsropensciorg) and their code peer review have facili-tated the implementation of best practice whilst holding au-thors to scientific scrutiny

Journals in the field of hydrology such as Hydrology andEarth System Sciences Water Resources Research and theAmerican Society of Civil Engineers (ASCE) journals Jour-

nal of Water Resources Planning and Management and Jour-nal of Hydrologic Engineering now actively encourage au-thors to publish the data and computer codes underlying theresults presented in their papers The journal Nature statesthat a manuscript can be rejected if the code used to generatenew analyses cannot be provided to the editors and review-ers Despite the advantages of sharing hydrological code fewcomputational hydrologists do this because cleaning and an-notating the code places an additional burden on the pub-lishing time frame However it is reasonable to assume thatas more journals require submission of codes with papersthe community of computational hydrologists (and associ-ated fields) will continue to grow and strengthen the field Inaddition to the sharing of open-source code reproducibilityexperts also advocate the use of software tool sets such asversion control scripting container technology and compu-tational notebooks to enhance the reproducibility of scien-tific results (Perkel 2018) Hydrological tutorials vignettesor teaching documents increasingly implement literate pro-gramming (Sect 21) where the code and results are de-scribed in plain English within the same document or webpage

In the hydrological sciences several ongoing open scien-tific initiatives can be noted other than the R packages that

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 2: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2940 L J Slater et al R in Hydrology

(Addor et al 2017) Together these datasets have facilitatedthe investigation of many catchments as well as interdisci-plinary research linking meteorology climatology hydrol-ogy and the earth sciences

In addition to the availability of large-scale data archivesthe increase in computational power and uptake of program-ming languages have also been a major driver of change inthe discipline Increasingly hydrologists are using data sci-ence approaches to derive process insights from large andcomplex datasets (eg Guo 2017) The ability to explore andmine these datasets has facilitated a move from in-depth ex-periments in single catchments towards large-sample studies(eg Villarini et al 2009 Berghuijs et al 2014 Slater et al2015 Archfield et al 2016 Bloumlschl et al 2017 Blum et al2017 Harrigan et al 2018) By applying an analysis to manycatchments or grouping those with similar characteristicshydrologists have been able to test the broad applicabilityof hydrological theories and draw systematic insights abouthydrological processes (eg Bloumlschl et al 2013) Large-sample studies are increasingly being employed to developnovel (conceptual andor physical) models that are applica-ble across diverse catchment conditions thereby improvingprocess understanding and leading to more robust predictions(eg Gupta et al 2014) At the same time a broad rangeof well-established lumped (eg GR4J Perrin et al 2003)and semi-distributed (eg TOPMODEL Beven 1997) mod-els of the hydrological cycle ndash many of which were initiallydeveloped in older languages such as Fortran ndash have nowbeen incorporated into R packages Some of them have beentranslated into R and others remain in their initial languageseg SWAT (Neistsch et al 2005) The uptake of empiricalconceptual and physically based computational hydrologi-cal models as well as the growth of large-sample studieshave driven the emergence of a field that can be describedas computational hydrology (eg Hutton et al 2016 Melsenet al 2017) a scientific paradigm that allows hydrologiststo explore hydrological questions with a computational ap-proach Computational hydrology aims to develop repro-ducible hydrological analyses that can be applied to manycatchments with the aim of generating novel and system-atic process insights that improve our physical understandingof the hydrological cycle The field differs somewhat fromboth hydroinformatics (eg Abbott et al 1991) which has agreater focus on information and communication technolo-gies andor black-box approaches to address water-relatedissues and geocomputation (eg Openshaw and Abrahart2000 Lovelace et al 2019) which uses similar computa-tional techniques for spatial data analysis

The growth of computational hydrology has been en-hanced by the development of the open-source program-ming language R originally developed for statistical com-puting by Ross Ihaka and Robert Gentleman in the 1990s(Ihaka and Gentleman 1996 R Core Team 2018) and sup-ported by an enthusiastic and rapidly growing online com-munity As a free multiplatform language R is highly ver-

satile and has a wide range of uses including data acqui-sition and provisioning manipulation analysis modellingstatistics visualization and even well-developed geospatialand geographic information system (GIS) applications Rcan be used for generating reports making interactive pre-sentations for teaching or conferences or even prototyp-ing dashboards and web applications One of the greateststrengths of R is its extremely active community of userswho in the past 25 years have developed and released in thepublic domain more than 14 000 packages spanning manyscientific disciplines The Comprehensive R Archive Net-work (CRAN httpscranr-projectorg) is the main repos-itory for these packages hosted by a network of FTP andweb servers around the world The abrupt increase in thenumber of hydrological package updates in 2018ndash2019 ex-emplifies the growing importance of the language in hydrol-ogy and strengthening of the community (Fig 1) These de-velopments have allowed the R language to fit comfortablyin production-ready ecosystems (eg web applications) andtake advantage of cutting-edge technologies and tools for im-proving reproducibility testing and continuous integration

This paper aims to provide a broad overview of the utilityof R in the hydrological sciences and of important develop-ments in recent years In Sect 2 we provide a summary ofthe many benefits and advantages of using R in hydrology InSect 3 we describe some of the key hydrological packagesthat have been developed by the community as well as gen-eral packages of broad application in the sciences In Sect 4we discuss some of the challenges that the hydrologic R users(R-Hydro) community faces including tools and solutions toovercome these challenges Finally in Sect 5 we list some ofthe future directions to strengthen the computational hydrol-ogy community

2 The benefits and advantages of using R in hydrology

21 Democratizing open science and numerical literacy

One of the principal advantages of R is its ease of use result-ing from typically detailed documentation a large numberof online resources object-oriented programming (the lan-guage is organized around objects with unique attributes)functional programming (the code can be written with func-tions to facilitate modularity and avoid changing-state data)and the availability of the source code under the open-sourcelicense Further R can be run on all major operating sys-tems (ie Microsoft Windows macOS and Linux) makingit ideal for institutional or personal use In contrast with com-piled languages such as C or Fortran R is an interpretedlanguage which means that the code can be written and ex-ecuted line by line In practice this means that achieving abasic hydrological analysis can be as simple as writing a se-quence of commands for reading a file cleaning the data andplotting a graph These sequences of commands are typically

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2941

Figure 1 The number of R packages available on CRAN (1997ndash2019) All packages are shown in (a) and hydrology packages only (definedas those that include the string ldquohydrordquo 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 httpscranr-projectorgsrccontribArchive) and (2) date of last publication ndash ie most recent publication date of packages that are currently available on CRAN(black bars httpscranr-projectorgwebpackagesavailable_packages_by_datehtml) In both cases each package is counted only once forexample the package hydroTSM was first released in 2010 (grey) but its most recent update was in 2017 (black) The script to produce thisfigure 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-stitute a hydrological workflow (see Fig 3) A high level ofdocumentation and support exists for each of the tasks withina hydrological workflow including a diverse range of pack-ages (see Sect 3) R users may search for R-relevant con-tent (such as expressions packages and functions) using thededicated Internet search engine RSeek (httpsrseekorg)as well as generalist search engines For many R newcomersthe initial hurdle is finding the time required to gain a basicunderstanding of R itself but these efforts pay off rapidly asone learns how to find solutions on the Internet (see Sect 25)and to navigate help files provided within R

One of the advantages of writing a script is that it canbe reused and improved incrementally over time so that theauthor never has to repeat a task manually (in contrast topoint-and-click software that lacks a programmatic inter-face) Moreover the same script can be reused repeatedly bydifferent people to reproduce a given result (avoiding dupli-cation of efforts) or to analyse different data eg differentcatchments different types of gridded data or the same dataat different points in time Thus scripts written in R (or otherlanguages) have wide-ranging benefits as they facilitate thetesting and quality control of the scientific workflow can beshared and improved by a team of users lessen the risk ofmaking manual mistakes and significantly enhance the speedwith which analyses can be conducted and updated

Recent developments in R have contributed to enhancingopen science and numerical literacy in the hydrological sci-ences Rrsquos ease of access and use has improved what mightbe termed ldquoscientific computing literacyrdquo within the hydro-logical community Volunteer projects such as the SoftwareCarpentry (Wilson 2006 2014) have been teaching basic

computing skills to researchers since 1998 and R now formsa central part of their training Over the past decade or soR has become one of the core tools for scientific compu-tation in hydrology Hosted instances of R allow the userto run R and RStudioreg (an integrated development environ-ment ndash IDE described in greater detail in Sect 42) in thecloud ie in a web browser rather than locally on onersquos owncomputer These hosted instances have made the languagemore accessible to non-specialists due to the large rangeof pre-installed packages Importantly the RStudio Cloud(httpsrstudiocloud) has recently been developed to makeit easy for professionals hobbyists trainers teachers andstudents to do share teach and learn data science using Rand provides many learning materials including interactivetutorials covering the basics of data science cheat sheets forworking with popular R packages and a guide to using RStu-dio Cloud Such hosted instances of R remove the initial hur-dle of installing R and the required packages (ie the techni-calities) and ultimately make scientific work more accessible

The R-Hydro community has developed a number of plat-forms to share computational hydrology analyses and codeis increasingly being shared via repositories (see Sect 51)Code and results can be published as traditional media (egas articles supplemental material scripts packages or com-putational environments) or on the web via blog posts snip-pets or tutorial documents allowing users to engage inter-actively The ldquoliterate programmingrdquo paradigm (ie inter-spersing snippets of code and written text within a uniquedocument see Knuth 1984) has also become increasinglypopular due to the development of dashboards and onlinepublishing platforms Dashboards are interfaces that may in-clude a group of related data visualizations such as charts

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 indicatedin coloured text these packages are described in further detail in Sect 31 to Sect 38

graphs tables and maps (eg Fig 6) They can be fixed(eg a non-interactive web page) or dynamic (eg allow-ing users to alter input values and see how outputs changevirtually in real time) Hydrologists have increasingly em-ployed dashboards to display their analyses in an interac-tive user-friendly manner using packages such as plotlya graphing library that makes publication-quality graphsonline (Sievert 2018) the shiny web application frame-work (Chang et al 2015) shinydashboard (Chang andBorges Ribeiro 2018) or the flexdashboard package(Iannone et al 2018) Additionally free services such asRPubs (a free web-publishing platform httpsrpubscom)and the aforementioned plotly enable the publishing ofthese static or interactive documents and visualizations on-line In doing so these publishing services facilitate immedi-ate interaction and knowledge transfer

22 Enhancing reproducible hydrological research andopen science

Reproducibility is a key feature of the scientific method andcan be broadly defined as the ability for the community to

reproduce and verify previous findings Encouraging repro-ducible practices helps reduce the likelihood of errors (meth-ods can be tested by other researchers) while increasing theuptake of any positive developments within a discipline (Hut-ton et al 2016) However scientific research is increasinglyunder fire for its lack of reproducibility due to an inadequatemethodology description (Ceola et al 2015) and model anddata availability True reproducibility requires more than themere repeatability of results with the same computer codeand data one must also be able to reproduce a studyrsquos con-clusions when testing the theory with different data or a dif-ferent model set-up (Melsen et al 2017)

The open-source nature of R packages and the CRANrepository set-up are one key added value of R to repro-ducible geoscientific research (Pebesma et al 2012) TheCRAN repository ensures the traceability of past analy-ses by archiving former versions of the packages com-piled on any platform (httpscranr-projectorg) In addi-tion packages are citeable in reports and papers togetherwith their version number allowing the user to track whichcode was used The package developers are also ldquotrace-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 theuser to split a dataset by categories (rows and columns) Here a probabilistic time-series GAMLSS model of flood frequency at one gaugingstation in Ohio USA is shown for four different seasons (rows) and two peak-over-threshold quantities (columns two to four peaks peryear) The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon) and the observed values are plotted in theforeground as grey circles (geom_point) Source Neri et al (2019)

ablerdquo on the CRAN via their ORCID (Open Research andContributor ID) number which provides an indication ofwhether they also authored any corresponding scientific pa-pers The CRAN Task Views provide guides to the pack-ages and tools that exist on CRAN for the different dis-ciplines Note that many packages are submitted to onlinerepositories such as GitHub that never make it to CRANfor a range of reasons but this does not necessarily makethem less reliable The Task Views provide a list of toolswhich can enhance reproducibility in R (see httpscranr-projectorgwebviewsReproducibleResearchhtml) Rely-ing on well-established publishing platforms such as CRANand GitHub has promoted the use of best practice in writ-ing R code Packages such as rhub (Csaacuterdi 2017) pro-vide code checks for packages on certain operating systemswhile roxygen2 helps users create documentation for theirR packages (Wickham et al 2018a) Other initiatives suchas rOpenSci (carefully vetted scientific R software tools seehttpsropensciorg) and their code peer review have facili-tated the implementation of best practice whilst holding au-thors to scientific scrutiny

Journals in the field of hydrology such as Hydrology andEarth System Sciences Water Resources Research and theAmerican Society of Civil Engineers (ASCE) journals Jour-

nal of Water Resources Planning and Management and Jour-nal of Hydrologic Engineering now actively encourage au-thors to publish the data and computer codes underlying theresults presented in their papers The journal Nature statesthat a manuscript can be rejected if the code used to generatenew analyses cannot be provided to the editors and review-ers Despite the advantages of sharing hydrological code fewcomputational hydrologists do this because cleaning and an-notating the code places an additional burden on the pub-lishing time frame However it is reasonable to assume thatas more journals require submission of codes with papersthe community of computational hydrologists (and associ-ated fields) will continue to grow and strengthen the field Inaddition to the sharing of open-source code reproducibilityexperts also advocate the use of software tool sets such asversion control scripting container technology and compu-tational notebooks to enhance the reproducibility of scien-tific results (Perkel 2018) Hydrological tutorials vignettesor teaching documents increasingly implement literate pro-gramming (Sect 21) where the code and results are de-scribed in plain English within the same document or webpage

In the hydrological sciences several ongoing open scien-tific initiatives can be noted other than the R packages that

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 3: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2941

Figure 1 The number of R packages available on CRAN (1997ndash2019) All packages are shown in (a) and hydrology packages only (definedas those that include the string ldquohydrordquo 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 httpscranr-projectorgsrccontribArchive) and (2) date of last publication ndash ie most recent publication date of packages that are currently available on CRAN(black bars httpscranr-projectorgwebpackagesavailable_packages_by_datehtml) In both cases each package is counted only once forexample the package hydroTSM was first released in 2010 (grey) but its most recent update was in 2017 (black) The script to produce thisfigure 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-stitute a hydrological workflow (see Fig 3) A high level ofdocumentation and support exists for each of the tasks withina hydrological workflow including a diverse range of pack-ages (see Sect 3) R users may search for R-relevant con-tent (such as expressions packages and functions) using thededicated Internet search engine RSeek (httpsrseekorg)as well as generalist search engines For many R newcomersthe initial hurdle is finding the time required to gain a basicunderstanding of R itself but these efforts pay off rapidly asone learns how to find solutions on the Internet (see Sect 25)and to navigate help files provided within R

One of the advantages of writing a script is that it canbe reused and improved incrementally over time so that theauthor never has to repeat a task manually (in contrast topoint-and-click software that lacks a programmatic inter-face) Moreover the same script can be reused repeatedly bydifferent people to reproduce a given result (avoiding dupli-cation of efforts) or to analyse different data eg differentcatchments different types of gridded data or the same dataat different points in time Thus scripts written in R (or otherlanguages) have wide-ranging benefits as they facilitate thetesting and quality control of the scientific workflow can beshared and improved by a team of users lessen the risk ofmaking manual mistakes and significantly enhance the speedwith which analyses can be conducted and updated

Recent developments in R have contributed to enhancingopen science and numerical literacy in the hydrological sci-ences Rrsquos ease of access and use has improved what mightbe termed ldquoscientific computing literacyrdquo within the hydro-logical community Volunteer projects such as the SoftwareCarpentry (Wilson 2006 2014) have been teaching basic

computing skills to researchers since 1998 and R now formsa central part of their training Over the past decade or soR has become one of the core tools for scientific compu-tation in hydrology Hosted instances of R allow the userto run R and RStudioreg (an integrated development environ-ment ndash IDE described in greater detail in Sect 42) in thecloud ie in a web browser rather than locally on onersquos owncomputer These hosted instances have made the languagemore accessible to non-specialists due to the large rangeof pre-installed packages Importantly the RStudio Cloud(httpsrstudiocloud) has recently been developed to makeit easy for professionals hobbyists trainers teachers andstudents to do share teach and learn data science using Rand provides many learning materials including interactivetutorials covering the basics of data science cheat sheets forworking with popular R packages and a guide to using RStu-dio Cloud Such hosted instances of R remove the initial hur-dle of installing R and the required packages (ie the techni-calities) and ultimately make scientific work more accessible

The R-Hydro community has developed a number of plat-forms to share computational hydrology analyses and codeis increasingly being shared via repositories (see Sect 51)Code and results can be published as traditional media (egas articles supplemental material scripts packages or com-putational environments) or on the web via blog posts snip-pets or tutorial documents allowing users to engage inter-actively The ldquoliterate programmingrdquo paradigm (ie inter-spersing snippets of code and written text within a uniquedocument see Knuth 1984) has also become increasinglypopular due to the development of dashboards and onlinepublishing platforms Dashboards are interfaces that may in-clude a group of related data visualizations such as charts

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 indicatedin coloured text these packages are described in further detail in Sect 31 to Sect 38

graphs tables and maps (eg Fig 6) They can be fixed(eg a non-interactive web page) or dynamic (eg allow-ing users to alter input values and see how outputs changevirtually in real time) Hydrologists have increasingly em-ployed dashboards to display their analyses in an interac-tive user-friendly manner using packages such as plotlya graphing library that makes publication-quality graphsonline (Sievert 2018) the shiny web application frame-work (Chang et al 2015) shinydashboard (Chang andBorges Ribeiro 2018) or the flexdashboard package(Iannone et al 2018) Additionally free services such asRPubs (a free web-publishing platform httpsrpubscom)and the aforementioned plotly enable the publishing ofthese static or interactive documents and visualizations on-line In doing so these publishing services facilitate immedi-ate interaction and knowledge transfer

22 Enhancing reproducible hydrological research andopen science

Reproducibility is a key feature of the scientific method andcan be broadly defined as the ability for the community to

reproduce and verify previous findings Encouraging repro-ducible practices helps reduce the likelihood of errors (meth-ods can be tested by other researchers) while increasing theuptake of any positive developments within a discipline (Hut-ton et al 2016) However scientific research is increasinglyunder fire for its lack of reproducibility due to an inadequatemethodology description (Ceola et al 2015) and model anddata availability True reproducibility requires more than themere repeatability of results with the same computer codeand data one must also be able to reproduce a studyrsquos con-clusions when testing the theory with different data or a dif-ferent model set-up (Melsen et al 2017)

The open-source nature of R packages and the CRANrepository set-up are one key added value of R to repro-ducible geoscientific research (Pebesma et al 2012) TheCRAN repository ensures the traceability of past analy-ses by archiving former versions of the packages com-piled on any platform (httpscranr-projectorg) In addi-tion packages are citeable in reports and papers togetherwith their version number allowing the user to track whichcode was used The package developers are also ldquotrace-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 theuser to split a dataset by categories (rows and columns) Here a probabilistic time-series GAMLSS model of flood frequency at one gaugingstation in Ohio USA is shown for four different seasons (rows) and two peak-over-threshold quantities (columns two to four peaks peryear) The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon) and the observed values are plotted in theforeground as grey circles (geom_point) Source Neri et al (2019)

ablerdquo on the CRAN via their ORCID (Open Research andContributor ID) number which provides an indication ofwhether they also authored any corresponding scientific pa-pers The CRAN Task Views provide guides to the pack-ages and tools that exist on CRAN for the different dis-ciplines Note that many packages are submitted to onlinerepositories such as GitHub that never make it to CRANfor a range of reasons but this does not necessarily makethem less reliable The Task Views provide a list of toolswhich can enhance reproducibility in R (see httpscranr-projectorgwebviewsReproducibleResearchhtml) Rely-ing on well-established publishing platforms such as CRANand GitHub has promoted the use of best practice in writ-ing R code Packages such as rhub (Csaacuterdi 2017) pro-vide code checks for packages on certain operating systemswhile roxygen2 helps users create documentation for theirR packages (Wickham et al 2018a) Other initiatives suchas rOpenSci (carefully vetted scientific R software tools seehttpsropensciorg) and their code peer review have facili-tated the implementation of best practice whilst holding au-thors to scientific scrutiny

Journals in the field of hydrology such as Hydrology andEarth System Sciences Water Resources Research and theAmerican Society of Civil Engineers (ASCE) journals Jour-

nal of Water Resources Planning and Management and Jour-nal of Hydrologic Engineering now actively encourage au-thors to publish the data and computer codes underlying theresults presented in their papers The journal Nature statesthat a manuscript can be rejected if the code used to generatenew analyses cannot be provided to the editors and review-ers Despite the advantages of sharing hydrological code fewcomputational hydrologists do this because cleaning and an-notating the code places an additional burden on the pub-lishing time frame However it is reasonable to assume thatas more journals require submission of codes with papersthe community of computational hydrologists (and associ-ated fields) will continue to grow and strengthen the field Inaddition to the sharing of open-source code reproducibilityexperts also advocate the use of software tool sets such asversion control scripting container technology and compu-tational notebooks to enhance the reproducibility of scien-tific results (Perkel 2018) Hydrological tutorials vignettesor teaching documents increasingly implement literate pro-gramming (Sect 21) where the code and results are de-scribed in plain English within the same document or webpage

In the hydrological sciences several ongoing open scien-tific initiatives can be noted other than the R packages that

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 4: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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 indicatedin coloured text these packages are described in further detail in Sect 31 to Sect 38

graphs tables and maps (eg Fig 6) They can be fixed(eg a non-interactive web page) or dynamic (eg allow-ing users to alter input values and see how outputs changevirtually in real time) Hydrologists have increasingly em-ployed dashboards to display their analyses in an interac-tive user-friendly manner using packages such as plotlya graphing library that makes publication-quality graphsonline (Sievert 2018) the shiny web application frame-work (Chang et al 2015) shinydashboard (Chang andBorges Ribeiro 2018) or the flexdashboard package(Iannone et al 2018) Additionally free services such asRPubs (a free web-publishing platform httpsrpubscom)and the aforementioned plotly enable the publishing ofthese static or interactive documents and visualizations on-line In doing so these publishing services facilitate immedi-ate interaction and knowledge transfer

22 Enhancing reproducible hydrological research andopen science

Reproducibility is a key feature of the scientific method andcan be broadly defined as the ability for the community to

reproduce and verify previous findings Encouraging repro-ducible practices helps reduce the likelihood of errors (meth-ods can be tested by other researchers) while increasing theuptake of any positive developments within a discipline (Hut-ton et al 2016) However scientific research is increasinglyunder fire for its lack of reproducibility due to an inadequatemethodology description (Ceola et al 2015) and model anddata availability True reproducibility requires more than themere repeatability of results with the same computer codeand data one must also be able to reproduce a studyrsquos con-clusions when testing the theory with different data or a dif-ferent model set-up (Melsen et al 2017)

The open-source nature of R packages and the CRANrepository set-up are one key added value of R to repro-ducible geoscientific research (Pebesma et al 2012) TheCRAN repository ensures the traceability of past analy-ses by archiving former versions of the packages com-piled on any platform (httpscranr-projectorg) In addi-tion packages are citeable in reports and papers togetherwith their version number allowing the user to track whichcode was used The package developers are also ldquotrace-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 theuser to split a dataset by categories (rows and columns) Here a probabilistic time-series GAMLSS model of flood frequency at one gaugingstation in Ohio USA is shown for four different seasons (rows) and two peak-over-threshold quantities (columns two to four peaks peryear) The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon) and the observed values are plotted in theforeground as grey circles (geom_point) Source Neri et al (2019)

ablerdquo on the CRAN via their ORCID (Open Research andContributor ID) number which provides an indication ofwhether they also authored any corresponding scientific pa-pers The CRAN Task Views provide guides to the pack-ages and tools that exist on CRAN for the different dis-ciplines Note that many packages are submitted to onlinerepositories such as GitHub that never make it to CRANfor a range of reasons but this does not necessarily makethem less reliable The Task Views provide a list of toolswhich can enhance reproducibility in R (see httpscranr-projectorgwebviewsReproducibleResearchhtml) Rely-ing on well-established publishing platforms such as CRANand GitHub has promoted the use of best practice in writ-ing R code Packages such as rhub (Csaacuterdi 2017) pro-vide code checks for packages on certain operating systemswhile roxygen2 helps users create documentation for theirR packages (Wickham et al 2018a) Other initiatives suchas rOpenSci (carefully vetted scientific R software tools seehttpsropensciorg) and their code peer review have facili-tated the implementation of best practice whilst holding au-thors to scientific scrutiny

Journals in the field of hydrology such as Hydrology andEarth System Sciences Water Resources Research and theAmerican Society of Civil Engineers (ASCE) journals Jour-

nal of Water Resources Planning and Management and Jour-nal of Hydrologic Engineering now actively encourage au-thors to publish the data and computer codes underlying theresults presented in their papers The journal Nature statesthat a manuscript can be rejected if the code used to generatenew analyses cannot be provided to the editors and review-ers Despite the advantages of sharing hydrological code fewcomputational hydrologists do this because cleaning and an-notating the code places an additional burden on the pub-lishing time frame However it is reasonable to assume thatas more journals require submission of codes with papersthe community of computational hydrologists (and associ-ated fields) will continue to grow and strengthen the field Inaddition to the sharing of open-source code reproducibilityexperts also advocate the use of software tool sets such asversion control scripting container technology and compu-tational notebooks to enhance the reproducibility of scien-tific results (Perkel 2018) Hydrological tutorials vignettesor teaching documents increasingly implement literate pro-gramming (Sect 21) where the code and results are de-scribed in plain English within the same document or webpage

In the hydrological sciences several ongoing open scien-tific initiatives can be noted other than the R packages that

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 5: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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 theuser to split a dataset by categories (rows and columns) Here a probabilistic time-series GAMLSS model of flood frequency at one gaugingstation in Ohio USA is shown for four different seasons (rows) and two peak-over-threshold quantities (columns two to four peaks peryear) The probabilistic model is plotted in the background as colour ribbons (using geom_ribbon) and the observed values are plotted in theforeground as grey circles (geom_point) Source Neri et al (2019)

ablerdquo on the CRAN via their ORCID (Open Research andContributor ID) number which provides an indication ofwhether they also authored any corresponding scientific pa-pers The CRAN Task Views provide guides to the pack-ages and tools that exist on CRAN for the different dis-ciplines Note that many packages are submitted to onlinerepositories such as GitHub that never make it to CRANfor a range of reasons but this does not necessarily makethem less reliable The Task Views provide a list of toolswhich can enhance reproducibility in R (see httpscranr-projectorgwebviewsReproducibleResearchhtml) Rely-ing on well-established publishing platforms such as CRANand GitHub has promoted the use of best practice in writ-ing R code Packages such as rhub (Csaacuterdi 2017) pro-vide code checks for packages on certain operating systemswhile roxygen2 helps users create documentation for theirR packages (Wickham et al 2018a) Other initiatives suchas rOpenSci (carefully vetted scientific R software tools seehttpsropensciorg) and their code peer review have facili-tated the implementation of best practice whilst holding au-thors to scientific scrutiny

Journals in the field of hydrology such as Hydrology andEarth System Sciences Water Resources Research and theAmerican Society of Civil Engineers (ASCE) journals Jour-

nal of Water Resources Planning and Management and Jour-nal of Hydrologic Engineering now actively encourage au-thors to publish the data and computer codes underlying theresults presented in their papers The journal Nature statesthat a manuscript can be rejected if the code used to generatenew analyses cannot be provided to the editors and review-ers Despite the advantages of sharing hydrological code fewcomputational hydrologists do this because cleaning and an-notating the code places an additional burden on the pub-lishing time frame However it is reasonable to assume thatas more journals require submission of codes with papersthe community of computational hydrologists (and associ-ated fields) will continue to grow and strengthen the field Inaddition to the sharing of open-source code reproducibilityexperts also advocate the use of software tool sets such asversion control scripting container technology and compu-tational notebooks to enhance the reproducibility of scien-tific results (Perkel 2018) Hydrological tutorials vignettesor teaching documents increasingly implement literate pro-gramming (Sect 21) where the code and results are de-scribed in plain English within the same document or webpage

In the hydrological sciences several ongoing open scien-tific initiatives can be noted other than the R packages that

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 6: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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 ananalysis-ready spatially explicit dataset for their region of interest Group B is interested in geomorphological processes and has developeda model to predict likely occurrence of mass movements which they also provide access to via an API During a period of extreme rainfallover a scientifically unrelated region both groups decide to adjust their methods and API to provide pertinent data (group A) which feed intopredictions of landslide risk (group B) Finally a disaster relief organization (group C) can swiftly act and use the outputs from the adaptedAPI (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-droShare web-based system for sharing hydrologic data andmodels which allows hydrologists to visualize analyse andwork with data and models on the HydroShare website (egcreating and publishing a web app resource Essawy et al2018) Additionally the Sharing Water-related Informationto Tackle Changes in the Hydrosphere for Operational Needs(SWITCH-ON) virtual laboratory aims to explore the poten-tial of open data for water security and management (Ceolaet al 2015) The reproducibility agenda has benefited fromstrong political and financial support with European Unionprojects like FOSTER Plus (Fostering the practical imple-mentation of Open Science in Horizon 2020 and beyond) thataim to encourage open science The European CommissionrsquosScience with and for Society programme implemented aspart of Horizon 2020 (European Commission 2015 p 17)similarly noted that the reuse of research data generated withpublic funding should have beneficial impacts for sciencethe economy and society As such open science is expectedto encourage interdisciplinary research and is considered akey approach to tackle the grand challenges of our time

23 Providing statistical tools for hydrology

There are many different types of software for statisticalanalysis but R is still considered the most powerful and pop-ular language and environment for statistical computing Forexample a search for the word ldquostatisticsrdquo on Stack Over-

flow the question and answer website for programmers on18 May 2019 generated 12 339 results with the tag ldquoRrdquo9582 results with Python 4916 with Java 2623 with Cand 48 with Fortran R is GNU S a language which canbe described as the modern implementation of the S lan-guage (Becker and Chambers 1984 Chambers 1998) andis specifically optimized for statistical computing In addi-tion to the standard statistical techniques within base-R (iethe inbuilt basic functions that define R as a language) Ralso provides access to a large variety of advanced and re-cent statistical packages which have been developed by itsuser community of statisticians and statistically minded sci-entists working in a range of research fields When compar-ing R with other similar open-source languages users oftendescribe Rrsquos unique selling point as the vast number of sta-tistical packages which liken it to a free community-drivenstatistical software

The statistical and graphical packages provided in R areparticularly useful for the hydrological sciences and includetechniques such as linear and non-linear modelling statisti-cal tests time-series analysis classification or clustering Adescription of specific statistical packages relevant to hydrol-ogy is provided in Sect 36

24 Connecting R to and from other languages

Many different programming languages are used in hydrol-ogy including older languages such as Fortran developed in

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 7: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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 ahydrological model and activate a snow model on the top left panel of the interface Modifying the parameters values (on the left) by usingthe sliding bars will automatically update the graphs and scores displayed (on the right) This interface highlights in an interactive manner thebasic principle of the rainfallndashrunoff relationship and its description in hydrological models At the bottom left of the interface an objectivefunction can be chosen and an automatic calibration procedure can be launched within the interface

the 1950s (eg Backus 1978) and C in 1972 (eg Ritchie1993) proprietary commercial languages eg MATLABreginitially released in 1984 (MathWorks 2018) and more re-cent open-source languages like Python which appeared in1990 (eg Sanner et al 1999 Guttag 2013) R in 1993 (egR Core Team 2018 Ihaka 1998) and Julia in 2012 (Bezan-son et al 2012)

S and R were both built using algorithms implementedmostly in Fortran and sometimes in C (Chambers 2016p 55) which is why R can be connected natively to bothlanguages Interconnections between R and other languagescan be very useful for taking advantage of each languagersquosstrengths or using pre-existing scripts that were originallywritten in other languages For example C and Fortran areboth efficient in performing loop tasks This is the reasonwhy the apply function loops are coded in C The airGR hy-drological models (Coron et al 2017 2018) also make useof Fortran in order to take advantage of its CPU efficiency

R can also be connected to different languages usinga range of packages eg C++ (package Rcpp Eddel-buettel and Balamuta 2017) and Java (package rJavaUrbanek 2018) Connections to Python can be achievedwith the packages reticulate (Allaire et al 2018b)rPython (Bellosta 2015) rJython (Grothendieck and

Bellosta 2012) and XRPython (Chambers 2017) Addi-tionally R can also be connected to JavaScript (eg pack-age V8 Ooms 2017) MATLAB (eg package RmatlabBengtsson 2018) or Julia (packages JuliaCall andXRJulia Chambers 2018 Li 2018) Conversely connect-ing other languages to R is also possible For example rpy2(Gautier 2018) is the Python interface to the R language andruns an embedded R providing access from Python using Rrsquosown C application programming interface (API) The Pythonlibrary pyRserve (Heinkel 2017) also connects Pythonwith R using Rserve (a TCPIP server which allows otherprograms to use facilities of R) The RCall package allowsusers to call R from Julia (Bates et al 2015)

25 Interacting with the R-Hydro community scientificresources and courses

One of the major advantages of R is the extensive usercommunity which provides ample support to newcomersthrough various initiatives and is growing at a fast paceR-Hydro beginners are strongly encouraged to join thediscussion on various R-related topics on social mediaOn Twitter the ldquorstatsrdquo community is particularly activeand users are exposed to communication about a rangeof new packages and recent developments Stack Overflow

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 8: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2946 L J Slater et al R in Hydrology

(httpsstackoverflowcom) is the go-to online discussion fo-rum for any user from beginners to expert developers andprovides code snippets to solve a wide range of commonproblems In addition the R Project also offers thematicmailing lists (httpswwwr-projectorgmailhtml) relatingto usage (R-help) package development (R-package-devel)and language development (R-devel) in order to help oth-ers report bugs or propose solutions More recent but al-ready extremely active is the RStudio Community forum(httpscommunityrstudiocom) which includes users inter-ested in RStudio-developed applications and packages

A wide range of scientific resources including onlinemanuals and tutorials in several languages have been de-veloped by the community The rOpenSci project (httpsropensciorg) brings together a community of volunteerswho promote the open development of packages in a non-profit initiative by reviewing scientific R packages beforethey are uploaded to CRAN rOpenSci has contributed no-tably to the development of best practice through free codereviews and targeted or invited blog posts Resources can befound in many places online such as the Journal of OpenSource Software (JOSS) which hosts a wealth of short pa-pers documenting R packages

Short courses ie voluntary training sessions for R usersrun during conferences like the European Geosciences Union(EGU) General Assembly have also grown in popularity inthe hydrological community in recent years (Fig 2) Sincethe 2017 EGU General Assembly the Using R in Hydrol-ogy short course has been organized in conjunction withthe Young Hydrologic Society (YHS httpsyounghscom)as part of the annual Hydrological Sciences division pro-gramme The core aim of the short course is to bring to-gether the R-Hydro community including both users whoare learning to program and advanced users who are eitherteaching computational hydrology or developing packagesfor hydrological analysis Recent advances in R for hydrol-ogy applications are demonstrated during the short courseand a platform for open discussion between guest speak-ers and course participants is provided By rotating topicseach year a valuable repository of slides code examples andfollow-up material is provided to the community on GitHub(httpsgithubcomhydrosoc see Sect 56 for further infor-mation) It is also worth noting that a regular short courseis also run at the EGU on R package development In addi-tion to the EGU other regular conferences and meetings suchas those run by the International Association of Hydrologi-cal Sciences (IAHS) and the Prediction in Ungauged Basins(PUB PUB Summer School) also organize R courses duringtheir meetings The IAHS Statistical Hydrology (STAHY)commission regularly organizes workshops and short courseson various statistical topics which typically come with acomputer-based component in R

Finally it is worth mentioning that the continued growthof the R community is supported by the R Consortium (httpswwwr-consortiumorgabout) a group with an open-source

governance and foundation model that supports the world-wide community of users maintainers and developers of Rsoftware The R Consortium provides support to the com-munity in multiple ways One example of such support isthe grant programme run by the R Consortiumrsquos Infrastruc-ture Steering Committee (ISC) which funds development ofprojects seeking to promote improvement of the R infrastruc-ture and to achieve long-term stability of the R community

3 R packages in a typical hydrological workflow

R is an ever-growing environment as can be seen in the num-ber of R packages that are developed every year (Fig 1)There are now hydrological packages for every step of astandard hydrological workflow (Fig 3) we describe eachof these steps in subsequent sections

31 Setting up a repository and finding the rightpackages

Setting up a repository with version control (ie a review-able and restorable history) at the start of a research projecthas many advantages A repository is a structured set of filesthat will track edits any team member makes to the projectsimilar to the track-changes function in common word pro-cessors In R version control can be implemented quite sim-ply by connecting RStudio with Git or Subversion throughhosting services like Bitbucket GitHub GitLab (which arelike Dropbox for code) There are just a few initial stepsto set up a repository These include (1) creating a localdirectory (folder) to host your (RStudio) project (2) creat-ing a Git or a Subversion repository online and (3) link-ing the two Beyond those three steps all the user needs todo is regularly commit (ie save) their code together witha very brief summary of the changes made These changescan then be uploaded updating and synchronizing the onlinerepository with labelled annotations (username and times-tamp) The repository can be public or private with differ-ent levels of administrator access for users Many tutorialson how to set up a repository in R can be found onlineOne example is the Software Carpentry course on R for Re-producible Scientific Analysis (httpsswcarpentrygithubior-novice-gapminder) which also provides valuable sugges-tions on how to structure a project repository (eg with read-only source data disposable generated data and folders suchas ldquoscrrdquo for scripts and ldquodocrdquo for documentation)

Once a project folder or repository has been set up onemight need to identify the most useful R packages and func-tions for the task at hand CRAN Task Views were recentlydeveloped to provide thematic lists of the packages that aremost relevant to specific disciplines The Hydrology TaskView for ldquoHydrological Data and Modellingrdquo (httpscranr-projectorgwebviewsHydrologyhtml) was published to

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 9: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2947

the CRAN in January 2019 and lists over a hundred pack-ages under the following categories

ndash Data retrieval This includes hydrological data sources(surface or groundwater both quantity and quality) andmeteorological data (eg precipitation radiation andtemperature both measurements and reanalysis)

ndash Data analysis This includes data tidying (eg gap fill-ing data organization and quality control) hydrographanalysis (functions for working with streamflow dataincluding flow statistics trends and biological indices)meteorology (functions for working with meteorologi-cal and climate data) and spatial data processing

ndash Modelling This includes process-based modelling(scripts for preparing inputs and outputs and run-ning process-based models) and statistical modelling(hydrology-related statistical models)

Additionally many of the other 38 Task Views that wereavailable in January 2019 were relevant to hydrology (httpscranr-projectorgwebviews) For example the Environ-metrics Task View contains a Hydrology and Oceanographysection and the High-Performance and Parallel Computingwith R Task View can also be useful for hydrologists us-ing large amounts of data Other relevant Task Views cover arange of topics such as time-series analysis machine learn-ing or spatial analysis

One last way of discovering relevant and useful hydrolog-ical packages is social media such as Twitter where manyhydrologists share their most recent publications as well aslinks to useful resources and packages Some of the Twitterhandles that highlight relevant packages for computationalhydrology include the USGS group supporting R scientificprogramming (httpstwittercomUSGS_R) or the rOpenScipage (httpstwittercomropensci)

32 Packages for retrieving hydro-meteorological data

One of the most useful computational advances in recentyears has been the development of packages designed specif-ically to retrieve data from online hydrological archives Dif-ferent packages have been designed for importing hydro-metric data from repositories such as dataRetrievalfor the US Geological Survey (USGS) National Water In-formation System (Hirsch and De Cicco 2015) or rnrfafor the UKrsquos National River Flow Archive (Vitolo et al2016a) Many of these packages provide vignettes that il-lustrate how to use the functions For example the USGSrsquoswaterData package allows the user to import USGS dailyhydrological data from the USGS web services plot time-series data fill in missing values or visualize anomalies overa range of timescales (eg 1 year 30 d or 1 d) in just a fewlines of code (see the waterData package vignette on theCRAN Ryberg and Vecchia 2017) Other relevant packagesare listed in Table 1

Additionally many data retrieval packages that are rele-vant to hydrological analyses have been developed by relatedscientific disciplines such as meteorology and climatologyIn the future it seems likely that most water and meteoro-logical agencies around the world will facilitate access tothese data via APIs and open-source packages (see Sect 54for further information on APIs and the possible future ofhydro-meteorological data provision) Table 1 is far from ex-haustive and there are many other relevant packages that areavailable on CRAN For example the new ecmwfr packageprovides a straightforward interface to the public ECMWFWeb API Services and the Copernicus Climate Data Store(CDS) where open datasets such as the ERA5 reanalysis areopenly available (Hufkens 2018)

33 Packages for reading manipulating and cleaningthe data

Once data have been retrieved or downloaded a broad rangeof packages are available for reading different types of dataand their associated metadata However these packages arenot specifically hydrological and so will be discussed herewith brevity Note that in many cases for example with thedataRetrieval package the data are imported directlyinto the R workspace Basic data formats such as csv andtxt can be read with base-R (readtable function) or with ad-ditional packages that form part of the tidyverse pack-age suite (Wickham 2017) which facilitate reading a rangeof formats including XLS(x) TSV and FWF (eg packagereadr Wickham et al 2018b) The rio package facili-tates data import and export by making assumptions aboutdata structure from the file extension (Chan et al 2018)

For reading or writing netCDF files a number of pack-ages like ncdf4 (Pierce 2017) easyNCDF (BSC-CNS andManubens 2017) stars (Pebesma 2018b) or raster(Hijmans 2017) can be used GRIB files can also be handledwith packages such as raster or gribr (Wendt 2018)There is still relatively minimal support for Open GeospatialConsortium (OGC) services in R although there are somepackages such as sos4R (of which a new version is expectedto be released on CRAN soon) ows4R (Blondel 2018b) orgeometa (Blondel 2018a)

Observed hydro-climatological time-series data typicallyneed to be ldquocleanedrdquo because they suffer from various datagaps and errors For an overview of the different issues withhydrological data see Wilby et al (2017) This step may in-volve handling missing data checking data completeness re-shaping and aggregating data or converting strings to dateformat We do not develop this section specifically becausethese are general tasks in R However for overviews and tu-torials on manipulating and cleaning hydrological data wepoint the reader to published resources from the Using R inHydrology workshop (see Sect 56)

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 10: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2948 L J Slater et al R in Hydrology

Table 1 Examples of packages for hydrological andor meteorological data retrieval See the Hydrology Task View for latest additions(httpscranr-projectorgwebviewsHydrologyhtml)

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 overNorth 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)

34 Packages for extracting driving data spatialanalysis and cartography

In the past R may have been a less powerful alternative tothe more established spatial software for processing largedatasets and extracting information Now however R can beparallelized more easily than other software (harnessing thepower of multiple processor cores to handle large datasets)and can integrate GIS analyses within a complete automatedhydrological workflow which includes data processing steps(before or after any GIS analyses) and any subsequent statis-tical analyses It is this integration of GIS as one step withinthe hydrological workflow that makes R extremely attractiveAs a result in recent years R has become the go-to methodfor geocomputation and geostatistics and can now be used asa GIS in its own right Multiple books have been publishedon the topic of spatial analysis and mapping with R (Bruns-don and Comber 2015) or more broadly geocomputationwith R (Lovelace et al 2019) which includes topics such asreading and writing geographic data and making maps in R

Many methods are now implemented within R for han-dling vectorial data with packages such as sp (Pebesma andBivand 2005 Bivand et al 2013) for plotting data as mapsor for spatial selection the package rgdal (Pebesma andBivand 2005 Bivand et al 2013) which provides bindingsto the Geospatial Data Abstraction Library (GDAL) for read-ing and writing data and access to projection and transfor-mation operations from the PROJ4 (Urbanek 2012) librarypackage rgeos (Bivand and Rundel 2018) which provides

an interface to the Geometry Engine Open Source (GEOS)library for geometrical operations or package sf (Pebesma2018a) which provides support for simple features to encodespatial vector data Version 30 of ggplot2 offers supportfor visualizing sf objects directly with a specific geometricobject (geom_sf) which allows users to visualize spatial data(raster and shape files) easily There is also a range of pack-ages for handling raster data like raster (Hijmans 2017)which can be used to read write manipulate analyse andmodel gridded spatial data and stars (Pebesma 2018b) forreading manipulating writing and plotting spatio-temporalarrays With all these packages R now has full cartogra-phy and mapping functionality and can produce sophisticatedmaps that are either static or interactive Packages such ascartography (Giraud and Lambert 2016) or tmap (Ten-nekes 2018) can both be used for creating symbols choro-pleth or other types of maps and for facilitating the visual-ization of spatial data distributions in thematic maps Thesetwo packages are quite similar in content but not in formcartography uses the painterrsquos model while tmap usesThe Grammar of Graphics and allows users to draw staticand dynamic maps with the same code Additionally ggmap(Kahle and Wickham 2013) is commonly used for visual-izing geolocating and routing spatial data on top of staticmaps such as Google Maps RgoogleMaps is used to in-teract with Google Maps while the JavaScript leaflet(Cheng et al 2018) library can be used for creating inter-active web maps R software can also be linked to a rangeof other GIS software to take advantage of specific capa-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 11: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2949

bilities R can access ArcGIS geoprocessing tools (ESRI2018) by building an interface between R and the ArcPyPython side package using the RPyGeo package (Brenninget al 2018b) R can also call wrappers for GDALndashOGR util-ities (GDAL Development Team 2018) using gdalUtils(Greenberg and Mattiuzzi 2018) There are also interpretedinterfaces between the GRASS GIS (GRASS DevelopmentTeam 2019) and R from within the GRASS environmentor from R using the packages spgrass6 (Bivand 2016)or rgrass7 (Bivand 2018) R can be integrated withthe QGIS software (QGIS Development Team 2018) usingRQGIS (Muenchow et al 2017) or with SAGA GIS (SAGADevelopment Team 2008) using RSAGA (Brenning et al2018a)

35 Packages for hydrological modelling

The next step in a typical hydrological workflow is to conducthydrological modelling by using the data inputs prepared inprevious steps Hydrological modelling often proceeds bysimplifying hydrological processes to test hypotheses aboutthe water cycle manage water resources reconstruct incom-plete flow time series predict extreme events (floods or lowflows) or anticipate the effects of future climatic or anthro-pogenic changes In Table 2 we highlight some of the keypackages that facilitate the implementation of certain hy-drological models in R As R can be used for every stepwithin the hydrological modelling process from importingand cleaning data to exploratory analyses data modellingdata analysis and graphical visualization it represents anideal language for hydrological modellers

Several well-known hydrological models are providedin these packages such as the HBV model in theTUWmodel package (Viglione and Parajka 2019) TOP-MODEL in the packages topmodel (Buytaert 2018) anddynatopmodel (Metcalfe et al 2015 2018) SWAT inSWATmodel (Fuka et al 2014) GR4J in airGR (Coronet al 2017 2018) and hydromad (Andrews et al 2011Andrews and Guillaume 2018) Some packages also in-clude degree-day snow models (eg airGR hydromadand TUWmodel) that are used in nival basins to simulatethe accumulation and melt of the snowpack which greatlyimpacts the flow regimes Many of the models included inthese packages are lumped (ie consider the catchment as asingle unit with area-averaged variables) or conceptual (ieprovide a simplified representation of the physical processeswith empirical equations describing the interactions betweenthe processes) models Some packages such as TUWmodeland topmodel allow a spatial distribution of the hydro-logical processes TUWmodel for instance allows the userto implement a semi-distributed application with differentia-tion into elevation zones while topmodel allows the userto make topographic index classes from a topographic indexmap The FUSE model (Clark et al 2008) originally im-plemented in Fortran is still actively developed and also has

a dedicated R package called fuse (Vitolo et al 2016b)that is a re-implementation of the FUSE 2011 model Thevast majority of the models in the above packages are deter-ministic however the fuse package can also provide en-sembles of conceptual lumped hydrological models and thehydromad package is intended to provide a flexible frame-work for assembling different soil moisture accounting androuting schemes

The above packages typically allow the user to run thehydrological models and usually provide some sample in-put data with executable examples Some packages provideoptimization algorithms criteria calculation and dedicatedplotting functions (eg airGR and RHMS) Developing hy-drological modelling packages in R is relatively straightfor-ward because of the languagersquos flexibility additionally asdiscussed in Sect 24 R can be connected to other pro-gramming languages This property allows R users to embedmodel codes that already exist into R and provides a morefriendly environment as many packages ease the analysis ofdata and model simulations

36 Packages for hydrological statistics

R was initially developed as a statistical computing languageand is still the primary language in which novel statisticalmethods are coded and distributed Statistical approaches areemployed for an extremely wide range of tasks in hydrologyand it is virtually impossible to give complete coverage of allpossible packages that might be useful to hydrologists Theskimr package provides compact and flexible summariesof data it can be used with pipes and displays nicely inthe console Many estimating procedures can be carried outusing the base-R stats package which includes for ex-ample correlation analysis and MannndashKendall testing lin-ear regression Poisson regression and Gamma regressionThere are also generalist packages for non-parametric trendtests such as trend (Pohlert 2018) which includes a broadrange of tests for trend detection correlation and detectionof change points or non-randomness Many general mod-elling packages have been found to be useful by hydrologistsfor example mgcv (Wood 2017) VGAM (Yee et al 2015)and GAMLSS (Rigby and Stasinopoulos 2005) which im-plements generalized additive regression models for a largenumber of distributional families While mgcv can be usefulfor more complex smoothing approaches (eg tensor prod-uct smooths or varying coefficient models) the focus ofGAMLSS is to develop flexible models for a large class ofdistributions which are not part of the exponential family ofdistributions allowing for parameters other than the locationto be modelled as a smooth function of the covariates of in-terest A hydrologist might therefore choose which packageto use depending on the most likely distribution of the datawhich are being analysed and the complexity of the analysisThe caret package (Kuhn et al 2018) is more commonlyused for predictive modelling and machine learning as it al-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 12: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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 httpscranr-projectorgwebviewsHydrologyhtml

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 Oehlschlaumlgel 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 LumpedSemi-distributed hydrological model for education purposes (Viglione and Parajka 2019)

lows the user to develop an impressive range of predictivemodels (eg neural networks deep learning and decisiontrees)

There are many packages available for common hydro-logical tasks A comprehensive set of functions for carry-ing out extreme value analysis (Coles 2001) can be foundin the extRemes package (Gilleland and Katz 2016) anda more complete overview can be found in the CRAN Ex-treme Value Analysis Task View nsRFA consists of a col-lection of statistical tools for objective (unsupervised) appli-cations of the regional frequency analysis methods in hydrol-ogy (Viglione 2018) L-moments can be implemented usingthe lmom Hosking (2019b) package while the lmomRFApackage (Hosking 2019a) enables regional frequency anal-ysis The lfstat (Koffler et al 2016) package providesfunctions to compute statistics and plots for low flows sim-ilar to those in the manual on low-flow estimation and pre-diction (WMO 2009) Many of the standard model evalu-ation metrics are provided directly within these packagesThe caret package for instance imports other packagessuch as ModelMetrics (Hunt 2018) to facilitate modelevaluation directly A range of packages have also been de-veloped specifically for model evaluation The hydroGOFpackage (Zambrano-Bigiarini 2017a) provides goodness-of-fit functions specifically for comparison of simulated and ob-served hydrological time series In Table 3 we present a briefoverview of some other packages for hydrological statisticsFor a broader overview of available packages and further ex-amples we point the reader to the CRAN Task View on ma-chine learning and statistical learning (httpscranr-projectorgwebviewsMachineLearninghtml)

37 Packages for static and dynamic hydrological datavisualization

Data visualizations play an important role in hydrologicalanalysis R makes them straightforward to implement andallows considerable flexibility R includes three main fami-lies of graphics packages a painter model natively presentin R and based on the S languagersquos GR-Z model (Becker andChambers 1977) the trellis graphs (eg the lattice pack-age Sarkar 2008) initially implemented in S and The Gram-mar of Graphics (Wilkinson 1999) The last two familiesare both based on the grid package (R Core Team 2018)a low-level abstraction layer that allows the development ofgraphical packages with different philosophies which meansthat the created graphics can be stored in objects to be up-dated and plotted again later

base-R can produce publication-quality figures it includesa series of functions and methods that allow the user toplot various types of visualizations and the output of sta-tistical models Visualizations are produced in base-R us-ing the graphics package (R Core Team 2018) whichrelies on the philosophy of superimposing elements of thegraphics (with no provision for deleting an element once itis drawn) and includes a range of functions to add straightlines arrows axes boxes grids legends or annotation toa plot While visualizations produced in base-R are highlycustomizable other packages provide more consistent in-teractions and a suite of highly useful functions to sum-marize highlight and split andor layer data with a min-imal amount of code A community favourite is the pack-age ggplot2 created by Wickham (2016b) which allowsa high level of flexibility and ldquotuningrdquo of the graphs de-pending on the usersrsquo needs ggplot2 is an implemen-tation of The Grammar of Graphics and allows users tobuild almost any type of graphic (see the R graph gallery at

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 13: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

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)

httpswwwr-graph-gallerycom) ggplot2 also containsfunctions like ldquofacetsrdquo (httpsplotlyggplot2facet) whichallow the user to split and plot the data by categories in manydifferent rows or columns Figure 4 provides a hydrologi-cal example of faceting where a statistical model is visu-alized for different seasons (rows) and different peak-over-threshold quantities (columns)

Dynamic charts ndash where the user can for instance hoverover one or multiple points to read the associated data ormetadata (eg a hydrometric station number or the valueof a point) ndash have also grown in popularity in hydrologicalanalyses in recent years These dynamic graphics are par-ticularly useful in inspecting data such as outliers or ex-plaining an analysis when teaching hydrology in the class-room (eg by zooming in on different parts of a time se-ries) Dynamic graphics including maps can be created byusing the plotly package (Sievert 2018) a graphic li-brary that allows the user to make graphs interactive withminimal extra code A number of JavaScript-based visual-ization libraries can also help achieve dynamic graphicsFor interactive time-series data requiring axis display fea-tures such as zooming and panning and highlighting of se-ries and points the dygraphs package (Vanderkam et al2018) provides an interface to the JavaScript charting li-brary The manipulate package (Allaire 2014) allows theuser to easily add sliders and other control tools to other-wise static plots Other JavaScript-based packages includerbokeh (Hafen and Continuum Analytics Inc 2016)which provides an interface to Bokeh allowing the user tocreate web-based plots with hover and dynamic functional-ities rAmCharts (Thieurmel et al 2018) creates interac-tive charts based on the amCharts JavaScript library whilethe highcharter (Kunst 2017) package is based on theHighcharts JavaScript library of graphics Examples of allof these implementations (including leaflet dygraphsplotly rbokeh highchart and other visualization li-braries) can be found at httpswwwhtmlwidgetsorg Weencourage the reader to explore these HTML widgets as theyshow how simple it is to implement dynamic graphics withjust a line or two of R code

Choosing the appropriate colour gradients for hydrolog-ical graphs and maps is key It is widely accepted nowthat certain colour schemes and notably the infamous rain-bow colour scale are poor choices for data visualization(Light and Bartlein 2004 Stauffer et al 2015) The rain-bow scheme has been shown to distort perceptions of dataand alter meaning by creating false boundaries between val-ues additionally it is not colourblind-safe and other alterna-tives like perceptually uniform colour maps have been sug-gested (Crameri 2018) The R language is strong in thearea of colour gradients and there are many colourblind-friendly palettes available for hydrology that follow effectivedata visualization guidelines (Kelleher and Wagener 2011)There are both manually defined and predefined palettes us-ing packages such as RColourBrewer (Neuwirth 2014)colorspace (Zeileis et al 2019) colorRamps (Keitt2012) or viridis (Garnier 2018) For example thecolorspace package can be used for colour palettes basedon hue chroma luminance (HCL colour palettes are based onhow humans perceive colour in contrast to the RGB colourspace which is based on technical demands of TVcomputerscreens) in meteorological visualizations (Stauffer et al2015)

38 Packages for creating presentations and documents

A vast array of packages have been developed in R for creat-ing dynamic presentations and documents which are partic-ularly useful for illustrating hydrological concepts Dynamicinterfaces and web-based applications can be created withshiny (Chang et al 2015) such as the airGRteaching(Delaigue et al 2018a b) interface (Fig 6 see Sect 55) Rcan also be used to generate animated GIF files for presen-tations for example to highlight temporal changes in landcover or reservoir levels from earth observation GIFs can becreated using for example gganimate (Pedersen 2018)to animate ggplot2 and create videos and animated imagefiles or caTools (Tuszynski 2018) for reading and writingGIF and ENVI (flat-binary raster files with an accompanyingASCII header file) files

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 14: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2952 L J Slater et al R in Hydrology

Additionally various packages have been designedto produce interactive maps such as leaflet(Cheng et al 2018) leafletR (Graul 2016)plotGoogleMaps (Kilibarda and Bajat 2012) orgoogleVis (Gesmann and de Castillo 2011) R alsooffers many tools for creating websites or blog postswith packages like rmarkdown (Allaire et al 2018c)blogdown (Xie et al 2017) or pkgdown (Wickham andHesselberth 2018)

Presentations books reports and documents can be gen-erated in LaTeX or Markdown natively with Sweave func-tionalities or with packages such as knitr (Xie 2018)markdown (Allaire et al 2018a) rmarkdown (Allaireet al 2018c) pagedown (to paginate the HTML output ofR Markdown with CSS for printing Xie and Lesur 2019)or bookdown (Xie 2016) These packages facilitate the au-tomation of such documents (eg monthly reports) throughin-line text tokens that are dynamically linked to data in Rrsquosworkspace

4 Challenges and solutions when using R in hydrology

41 Hydrological libraries documentation andvignettes

For most hydrologists who are new to R the initial hurdleis understanding how to install libraries and use packages toexplore their own datasets The book R packages (Wickham2015) is freely available online and explains everything fromthe basic installation of packages to the role of metadata un-derstanding documentation the role of vignettes and bestpractice on GitHub (one common collaboration and versioncontrol platform)

R packages centralized on CRAN are structured similarlywith a reference manual source code a license file and othercommon elements The code and documentation of all pack-ages is verified before they are uploaded to CRAN R pack-ages ideally provide two forms of documentation a shortform (help pages) and a long form (vignettes) which areboth complementary and serve different purposes (Wickham2015) The help pages explain what each function does de-scribe the required input and the produced output and usu-ally include a section with executable examples Vignettesin contrast are tutorials that illustrate how R packages andtheir functions are used often with discussion of the out-puts However not all packages include a link to a vignetteon the CRAN repository as this is not compulsory Develop-ing clear and useful vignettes is one of the key challenges infacilitating the uptake of new packages and methods in factthese are key to reducing the misuse of software and ensuringthat the package users understand the methods Use cases canbe written as blog posts or tutorial-style papers with expla-nation of how to correctly interpret and implement a specificmethod and helping the community move forward

42 Integrated development environments (IDEs)facilitating the use of R

IDEs are software applications that are used to facilitate cod-ing by providing the code editor compiler or interpreter anddebugger within a single graphical user interface (GUI) Arange of IDEs exist for R such as Eclipse ndash StatET (anEclipse-based IDE eg des Riviecircres and Wiegand 2004Wahlbrink 2016) Emacs Speaks Statistics (ESS an add-onpackage for GNU Emacs Rossini et al 2004) MicrosoftrsquosR Tools for Visual Studio (RTVS a plug-in for the MicrosoftVisual Studio IDE eg Beard 2016) RKWard (which in-tegrates with the KDE desktop environment Roumldiger et al2012) Tinn-R (a replacement for the basic code editor de-signed to replace Rgui Faria et al 2008) or Vim or Neovim(a terminal-based working environment designed to facilitateworking in a pure command-line interface eg Neil 2018)

The RStudio IDE (RStudio Team 2018) is the most popu-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 RStudiois available in two editions an open-source edition and an en-terprise edition with a commercial license Both can run ona desktop (RStudio Desktop) or server (RStudio Server) andcan be installed on different platforms (Windows macOSand Linux) Most hydrologists use the free RStudio Desk-top edition although university departments and companiesincreasingly offer server editions too RStudiorsquos features in-clude a console a syntax-highlighting editor that supportsdirect code execution integrated R help and documentationsupport for version control systems and tools for plottinghistory debugging and workspace management

The RStudio environment makes it straightforward for hy-drologists to conduct a range of tasks (eg visualize datacreate dynamic graphs or web applications with shiny useversion control or develop and view R Markdown presenta-tions for example in LaTeX HTML or presentation slides)all within the IDE Other advantages of RStudio include theeasy access to the help window the ease of package man-agement and updating code debugging or even the easy de-velopment of packages in one location All of these benefitscontribute to facilitating open hydrological science RStudioversion 12 includes many new features to help interact withother programming platforms such as the reticulate(Allaire et al 2018b) and r2d3 (Luraschi and Allaire 2018)packages which make it easy to call Python and D3 fromwithin R sessions and R Notebooks An exhaustive list offeatures can be found on the RStudio website (httpswwwrstudiocomproductsRStudio)

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 15: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2953

43 Big data and parallel computing challenges inhydrology

In the early years of R the software was unable to han-dle large data files exceeding millions of rows or complexdata formats However both of these limitations have sincebeen overcome Some of the early packages for handlinglarge data files include bigmemory (Kane et al 2013) orbiganalytics (Emerson and Kane 2016) where ma-trices are allocated to shared memory and use memory-mapped files More recently the package datatable(Dowle and Srinivasan 2018) has gained increasing popu-larity for enhanced data frames allowing fast aggregationof large data (eg 100 GB in RAM) or fast ordered joinsIn hydrology some of the spatial data handling packagesare particularly relevant such as the sf package (Pebesma2018a) for large shape files or the feather (Wickham2016a) package for feather files a lightweight binary colum-nar data store designed for maximum speed Database con-nections can be established using a range of packages such asRPostgreSQL (Conway et al 2017) or RSQLite (Muumllleret al 2018) Distributed data frames can be implemented us-ing packages such as sparklyr (Luraschi et al 2018)

As the volume of available data increases and hydrologistsuse a greater number of models and ensembles parallel com-puting ndash where many calculations are carried out simultane-ously instead of sequentially ndash has become an essential toolin computational hydrology and has sped up analyses Forinstance instead of using traditional for-loops (an approachwhere one action is carried out over a dataset iteratively) thedata may be broken down into groups (eg by year or by sea-son) and functions can be applied to each group in parallelThe performance boosts that can be achieved by parallelizingthe code (ie using more than one core at a time) are consid-erable Even without access to a high-performance computeror cluster it is possible to perform hydrological tasks fastersince most local machines now have between 4 to 16 coresR has multiple facilities and packages for enabling the paral-lelization of code execution At the most simple level base-Rfunctions like lapply and sapply can be used to apply a spe-cific function to a vector or list input which can speed upanalyses considerably For instance the base-R parallelpackage for distributed computing provides methods to ac-cess additional computational power by allocating availableprocessing cores into a cluster The foreach (Microsoftand Weston 2017) and doParallel (Microsoft Corpora-tion and Weston 2018) packages can also be used togetherto execute ldquofor-eachrdquo loops in parallel

Other packages that are widely used for parallel computingin hydrology and other areas include the snowfall (Knaus2015) package which facilitates the development of parallelR programs eg by including extended error checks Addi-tionally some packages have parallel functionalities that areintegrated directly within the package such as the h2o pack-age (LeDell et al 2018) that provides an interface to H2O

a scalable platform offering parallelized implementations ofsupervised and unsupervised machine learning algorithms

5 A roadmap for the future of R in hydrology

As we have shown above the development of R fostersprogress in hydrology In this section we discuss what weperceive as some of the future avenues for enhancing hydro-logical research or operational hydrological practice with Rand how we can achieve these as a community

51 Sharing R code with the community

Open research practices bring significant benefits to re-searchers (McKiernan et al 2016) such as increases in ci-tations media attention potential collaborators job oppor-tunities and funding opportunities Most importantly shar-ing code increases the likelihood that an approach will beused by other scientists in their research and saves new usersthe trouble of ldquoreinventing the wheelrdquo and writing codes thathave already been developed by others There are many dif-ferent platforms for sharing and publishing R code such asGitHub Figshare and RPubs or Plotly (also for dashboardsand interactive plots) To obtain a DOI users may wish to userepositories such as Zenodo a general purpose open-accessrepository which allows researchers in the sciences and hu-manities to deposit datasets research software and create re-ports The data publisher PANGAEA additionally is specif-ically tailored to archiving publishing and reuse of data inearth and environmental sciences For further guidance someof these platforms are discussed in the code and data policysection of the open-access journal Geoscientific Model De-velopment

52 R packages as a driver of progress in hydrology

The consistent stream of new R packages has been a greatdriver for progress not only in hydrology but even in sciencemore broadly as packages favour the uptake and develop-ment of methods Additionally the open-source nature of Rpackages means that different users can contribute feedbackto R package developers and help enhance existing code Rusers can raise issues for certain packages directly on on-line platforms hosting the repositories (such as GitHub orGitLab) to foster an online-documented discussion with thepackage developers (generating interaction in the commu-nity) Package authors can also add a bug report link or anemail address in their package description file (common bestpractice for developers) to specify how they prefer to receivebug reports This feedback between users and developers isone key route to scientific progress Users can identify is-sues or suggest improvements by commenting on online col-laboration platforms (eg GitHub or GitLab) or by email-ing the developer or maintainer Most packages are hostedon these repository hosting platforms before becoming avail-

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 16: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2954 L J Slater et al R in Hydrology

able via the CRAN archive ensuring that a certain standardand best practice are met Although CRAN itself does nothave any mechanism to check the quality or cleanness ofthe code there is a suite of packages that are used to (i)ensure clean code and documentation that follow a widelyaccepted style guide such as the lintr (Hester 2018)goodpractice (Csardi and Frick 2018) and hunspell(Ooms 2018) packages and to (ii) rigorously test the func-tions against predefined outcomes using for example thetestthat package (Wickham 2011) In comparison withGitHub CRAN is an organized repository which providesexecutables for several platforms whereas finding an hydro-logical R package on GitHub can be difficult The compar-ison between the two is somewhat like visiting a curatedart auction versus an antique store Additionally CRAN hasmore thorough checks and gives visibility andor searchabil-ity to a package also signalling that the author intends tomaintain the package over the long term

Developing an R package requires a structured approachjust like writing a scientific paper There are many generalistresources for writing R packages such as the R package book(see httpr-pkgshadconz Wickham 2015) or a suite ofvideo tutorials on YouTube The main requirements for pub-lishing a package are listed on the CRAN website Provid-ing documentation and tutorials eg via blog posts or goodREADME files is essential Package authors can also pro-vide user-friendly and modular functions to aid maintenanceand future development (eg through external contributionsor suggested changes on online platforms) The RHub ser-vice also provides a ldquobuild and checkrdquo service for R packages(Csaacuterdi 2017)

Authoring hydrology-based R packages that can stand upto scientific scrutiny and ensure user-friendliness is not a mi-nor task and such investment should be recognized withinthe community Fuelling the development and disseminationof new R-based methods is therefore the joint responsibil-ity of developers authors and journal editors If developersinclude digital object identifiers (DOIs) as well as instruc-tions for citation within their software then authors can sub-sequently cite these packages The adequate reference or ref-erences can be obtained with the citation function for everypackage The references generally comprise a reference tothe package (with CRAN link and package version whichis key for encouraging reproducibility) and sometimes alsoinclude an additional journal paper reference If both areavailable then ideally both must be cited to provide recog-nition of computational scientistsrsquo contribution to the hydro-logical community and to enhance the reproducibility of theresearch Editors might also support reproducibility via spe-cial issues or sections for technical notes Dedicated softwarejournals such as the Journal of Open Source Software canbe used to publish brief technical descriptions of R pack-ages Any potential apprehensions for publishing such meth-ods (eg due to a lack of scientific scrutiny) can be alleviatedthrough software peer review initiatives such as those pro-

vided by rOpenSci It is worth noting that when writing newpackages the open-source approach has both pitfalls (riskof errors in new packages) and strengths (community reviewand range of tests that can be implemented via the above-mentioned packages)

53 Harmonizing hydrological workflows

One of the main challenges today for hydrological work-flow harmonization is to standardize calls for data whichare structured in different ways by data providers around theworld While the number of packages for hydrological dataretrieval has grown considerably (see Table 1) the packagesare structured differently because they were set up indepen-dently and because the underlying hydrological and hydro-metric datasets differ from country to country As more na-tions develop similar hydrological data acquisition packageswe believe it would be worth implementing a common syn-tax and data output form For example it would be ideal touse consistent APIs and output objects across packages Sug-gesting the ldquoidealrdquo format is beyond the scope of this paperbut a potential task force might be set up to help draft a wayforward for the community There is currently no effort tocombine data retrieval packages from different regions butit might be worth implementing a meta-package with func-tions that convert hydrometric data from other packages toa standard format or one for hydrological models to be runwithin the same framework Additionally the growing ten-dency towards data standardization at the global level mayfacilitate the development of consistent data retrieval pack-ages Examples of global data standards include WaterMLthe Open Geospatial Consortium standards for hydrologicaltime series or TimeseriesML a more generic candidate stan-dard currently under discussion As more water agencies anddata providers adopt such standards it will become mucheasier to develop consistent data retrieval packages and intheory we may no longer require different packages for dataretrieval because the only component that should change isthe server endpoint

54 APIs hydrological data acquisition and provision

APIs play a key role in hydrological data acquisition andprovision and are likely to become increasingly important inthe future An API is a set of code which usually includessubroutine definitions communication protocols and toolsfor building software and interacting with different datasetsAPIs are specific to the use case by definition but the inter-face is often provided in HTTP (ie web protocol) so thatrequests and responses can be made and received by a widerange of languages or systems For R users hydrological in-teraction with HTTP APIs usually comes in the form of dataacquisition packages such as the aforementioned packagesrnrfa (Vitolo et al 2016a) tidyhydat (Albers 2017)or daymetr (Hufkens et al 2018) These packages provide

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 17: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2955

means of posting requests via the R command line and thenreturn an R object for subsequent manipulation Internallythe source code translates all inputs and outputs to and fromHTTP Programmatically accessing a variety of vast onlineresources (ie data) in this way has considerably advancedour understanding of the earth sciences

Recent developments however have opened up a new andarguably under-utilized approach to APIs for the R commu-nity rather than exploiting an existing interface R users cannow increasingly rely on a set of tools to develop and maketheir own APIs accessible for use by third parties via HTTPNoteworthy projects here are OpenCPU (client and scalablecloud implementation Ooms 2014) and RStudiorsquos plumbrpackage (Lawrence and Wickham 2018) API developmentis likely to become a major avenue of future advances in sci-entific computing within the hydrological community as wellas interaction beyond the scientific realm Such APIs can pro-vide access to the latest raw or analysis-ready data methodsor even entire (statistical) models written in R

The simplicity and ubiquitous implementation of HTTPhave vast implications of which we highlight four (1) Com-mon issues with interoperability between languages can beovercome and more attention can be afforded to gaininginsights rather than developing (often convoluted) languagebridges (termed a ldquoseparation of concernsrdquo Heineman andCouncil 2001) This means for the first time that fullyseamless interaction between research groups working in dif-ferent languages is possible (eg between R Python andMATLAB) (2) Computational infrastructure can be scaledwith comparatively little technical knowledge increasing Rrsquosaptitude to a wider range of applications (3) Outputs canbe made accessible to third parties with or without a deeperunderstanding of the underlying science (4) Empirical dataare rarely ldquocleanrdquo and scientific computing hence has to beadaptable R source code can be altered to account for chang-ing data while maintaining a standardized public-facingAPI To highlight potential strengths of such APIs we pro-vide a brief interdisciplinary use-case scenario rooted in nat-ural hazard management and hydrological sciences in Fig 5

55 Teaching hydrology in R

Due to its relative ease of use and open-source nature R isincreasingly being used as an interactive tool for teachingin the hydrological sciences Many examples of typical hy-drological analyses can be found online as tutorials (see forexample Hurley 2018) The USGS also publish relevant ex-amples as a hydrological blog at httpsowiusgsgovblogwhich may be of interest to the community

R packages such as airGRteaching or TUWmodelhave also recently been developed to facilitate teach-ing of hydrological modelling The TUWmodel package(Viglione and Parajka 2019) provides a lumped concep-tual rainfallndashrunoff model based on the well-known HBVmodel (Bergstroumlm and Forsman 1973) and is designed

for educational purposes The airGRteaching package(Delaigue et al 2018a b) provides access to a suite of GRrainfallndashrunoff models such as GR4J for use by students withlimited programming skills only three basic functions areneeded to prepare the data calibrate a model and run or eval-uate a simulation and a single function can produce plotsdirectly using objects from the three previously mentionedfunctions In addition a graphical shiny web applicationis included to explore data and model results with automaticupdating of the plots and scores when the model parametersare modified by students the app allows users to explore theinternal fluxes and state variables of the models (Fig 6) Suchtools can be used for understanding and illustrating the mainhydrological processes and concepts and for relating them tohydrological modelsrsquo components and parameters

There is now an increasing number of online applica-tions that allow beginners to learn R in a sandbox ie avirtual space for testing coding online Sandboxes are par-ticularly useful for introducing basic methods in computa-tional hydrology without having to master the technicalitiesof R Examples of R sandboxes include the RStudio Cloud(httpsrstudiocloud) which can be used to learn teachor test R code Another sandbox initially called R-Fiddleis now called datacamp-light (httpsgithubcomdatacampdatacamp-light) Many other R sandboxes can be found on-line Thus rather than installing R on multiple PCs sand-boxes can be used by educators or lecturers by asking stu-dents to connect directly to the web

56 Developing the community short courses helpdesks and meet-up events

This paper reflects the strong collective desire to developthe community of computational hydrologists in R As men-tioned in Sect 25 the R-Hydro community has been meet-ing regularly in recent years at the EGU General Assemblyduring the short course Using R in Hydrology This courseis run annually by the YHS and is typically attended by awide range of hydrologists ranging from beginners to moreexperienced users (Fig 2) The resources and teaching pre-sentations from the short course are made available to thecommunity online on the YHS GitHub pages (httpsgithubcomhydrosoc) and archived on the Zenodo repository (seeBoessenkool et al 2017 Slater et al 2018 Hurley et al2019) These presentations include a range of topics such asobtaining cleaning and visualizing hydrological data withR parallel and high-performance computing for hydrolo-gists automating tasks using R Shiny with hydrologicaldata modelling the hydrological cycle in snow-dominatedcatchments community-led initiatives using R as a GIS dis-charge time-series visualization extreme value statistics hy-drological modelling trend analysis accessing hydrologicaldata using web APIs extracting gridded netCDF data reportgeneration and other hydrological tasks in R

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 18: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2956 L J Slater et al R in Hydrology

Figure 7 The R community Left the R meet-up groups (httpswwwmeetupcomtopicsr-project-for-statistical-computing) Right theR-Ladies global organization (httpsrladiesorgabout-us)

Many other R conferences will be of relevance to the read-ers including the useR conference RStudio satuRdays oreRum These conferences are not specific to hydrology andearth sciences but usually have some discipline-specific ses-sions as well as sessions and short courses of general interestfor learning R including best practice spatial analysis andstatistical methods Many of these conferences also streamthe talks andor make resources available after the event

The global reach of R meet-up groups has also grownrapidly such as the official R user group meet-up (httpr-users-groupmeetupcom) Many local initiatives for Rusers have regular meet-ups and seminar series and can befound either on the meet-up website or on social media webpages such as Twitter (eg httpstwittercomrusersoxford)There is also an ongoing push for greater inclusivity of under-represented groups in programming as exemplified by therapid growth of the global R-Ladies movement (Fig 7)

In addition the computational community has been try-ing to provide support to other programmers by running cod-ing help desks such as at the American Geophysical Union(AGU) 2018 fall meeting in the career centre Geoscientistvolunteers ran the desk in 2018 to provide perspective andadvice to other coders with a range of short 10 min tuto-rials on topics such as keeping track of code versions withGitHub making high-quality plots or using a new packageor library We anticipate that such help desks short coursesand meet-up sessions will continue to help grow the compu-tational hydrology community in future years

6 Conclusions

Over the last decade the open-source programming languageR has acquired a central role in hydrological research as wellas in the operational practice of hydrology With the rapidlyincreasing number of packages that are now available for ev-ery step of the hydrological workflow R facilitates a broadrange of hydrological analyses from start to finish This paperprovides an overview of the use of the open-source program-ming language R in hydrology by describing these packagesas well as the influence of R on the discipline Both the flexi-ble nature of the language and the diverse range of computa-tional visualization and modelling tools (physically basedand statistical) have facilitated the testing of hydrologicaltheories over a range of spatial and temporal scales as wellas interactive teaching of hydrology within the classroom

By sharing codes proposing new packages or contribut-ing to the improvement of existing packages we believe thatthe R-Hydro community will continue to facilitate furtheradvances in hydrology with wide-ranging improvements ofhydrological theory models and tools These new computa-tional tools and approaches are essential to achieving long-term goals in hydrology such as the IAHS Science Plan forthe decade 2013ndash2022 ldquoPanta Rhei Change in hydrologyand societyrdquo which seeks to improve the assessment attri-bution and modelling of hydrological change The rise ofcomputational hydrology also plays a key role in enhancingthe reproducibility of science and the computational literacyof both scientists and practitioners Within scientific researchlabs we anticipate that committing code to a repository willbecome standard practice as will the submission and review

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 19: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2957

of code along with papers as part of the scientific publicationprocess In the future as open-source programming data sci-ence and computational modelling become more widespreadin schools and universities it is plausible to expect that R willcontinue to play an increasing role in hydrology

Data availability The data used to create Fig 1 are publicly avail-able code to download the data and reproduce the figure is providedas a Supplement to this paper All URLs mentioned in the paperwere last accessed on 23 June 2019

Supplement The supplement related to this article is availableonline at httpsdoiorg105194hess-23-2939-2019-supplement

Author contributions All authors co-wrote the paper

Competing interests The authors declare that they have no conflictof interest

Acknowledgements We thank two anonymous reviewers MichaelStoelzle and Paul Astagneau for comments that improved the paperWe also thank all those who have contributed to the R-Hydro com-munity and the R community more broadly whether by developingand sharing their code or helping and teaching others to use thesetools In particular we thank the guest speakers who participated inthe Using R in Hydrology EGU short course

Review statement This paper was edited by Erwin Zehe and re-viewed by Michael Stoelzle and two anonymous referees

References

Abbott M B Hydroinformatics information technology and theaquatic environment Avebury Technical Aldershot 1991

Addor N Newman A J Mizukami N and Clark M P TheCAMELS data set catchment attributes and meteorology forlarge-sample studies Hydrol Earth Syst Sci 21 5293ndash5313httpsdoiorg105194hess-21-5293-2017 2017

Albers S tidyhydat Extract and Tidy Canadian Hydromet-ric Data The Journal of Open Source Software 2 511httpsdoiorg1021105joss00511 2017

Allaire J manipulate Interactive Plots for RStudio availableat httpsCRANR-projectorgpackage=manipulate r packageversion 101 2014

Allaire J Horner J Xie Y Marti V and Porte N mark-down ldquoMarkdownrdquo Rendering for R available at httpsCRANR-projectorgpackage=markdown r package version 09 2018a

Allaire J Ushey K and Tang Y reticulate Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=reticulate Rpackage version 110 2018b

Allaire J Xie Y McPherson J Luraschi J Ushey K AtkinsA Wickham H Cheng J and Chang W rmarkdown Dy-namic Documents for R available at httpsCRANR-projectorgpackage=rmarkdown R package version 110 2018c

Andrews F and Guillaume J hydromad Hydrological ModelAssessment and Development available at httphydromadcatchmentorg R package version 09-26 2018

Andrews F Croke B and Jakeman A An open soft-ware environment for hydrological model assessment anddevelopment Environ Modell Softw 26 1171ndash1185httpsdoiorg101016jenvsoft201104006 2011

Arabzadeh R and Araghinejad S RHMS Hydrologic ModellingSystem for R Users available at httpsCRANR-projectorgpackage=RHMS R package version 14 2018

Archfield S A Hirsch R M Viglione A andBloumlschl G Fragmented patterns of flood change acrossthe United States Geophys Res Lett 43 10ndash232httpsdoiorg1010022016GL070590 2016

Backus J The history of Fortran I II and III ACM Sigplan No-tices 13 165ndash180 1978

Bates D Lai R Byrne S and contributors RCall package avail-able at httpsgithubcomJuliaInteropRCalljl 2015

Beard B Setup and Installation of R Tools for Visual Studio inBeginning SQL Server R Services 33ndash71 Apress Berkeley CA2016 Beard B 2016 Setup and Installation of R Tools for Vi-sual Studio In Beginning SQL Server R Services (pp 33-71)Apress Berkeley CA

Becker R A and Chambers J M GR-Z A System of Graph-ical Subroutines for Data Analysis in Computer Science andStatistics 409ndash415 US Dept of Commerce National Bureauof Standards for sale by the Supt of Docs US Govt PrintOff Gaithersburg Maryland 1977

Becker R A and Chambers J M S an interactive environ-ment for data analysis and graphics The Wadsworth statis-ticsprobability series Wadsworth Advanced Book ProgramBelmont California 1984

Bellosta C J G rPython Package Allowing R to Call Pythonavailable at httpsCRANR-projectorgpackage=rPython rpackage version 00-6 2015

Bengtsson H Rmatlab Read and Write MAT Files and Call MAT-LAB from Within R available at httpsCRANR-projectorgpackage=Rmatlab r package version 362 2018

Berghuijs W Woods R and Hrachowitz M A precipitation shiftfrom snow towards rain leads to a decrease in streamflow NatClim Change 4 583 httpsdoiorg101038nclimate22462014

Bergstroumlm S and Forsman A Development of a conceptual de-terministic rainfall-runoff model Nordic Hydrol 4 147ndash170httpsdoiorg102166nh19730012 1973

Beven K TOPMODEL a critique Hydrol Process11 1069ndash1085 httpsdoiorg101002(SICI)1099-1085(199707)119lt1069AID-HYP545gt30CO2-O 1997

Bezanson J Karpinski S Shah V B and Edelman A Julia Afast dynamic language for technical computing arXiv preprintarXiv12095145 2012

Bivand R spgrass6 Interface between GRASS 6 and R avail-able at httpCRANR-projectorgpackage=spgrass6 R pack-age version 08-9 2016

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 20: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2958 L J Slater et al R in Hydrology

Bivand R rgrass7 Interface Between GRASS 7 Geographical In-formation System and R available at httpsCRANR-projectorgpackage=rgrass7 R package version 01-12 2018

Bivand R and Rundel C rgeos Interface to Geometry Engine ndashOpen Source (ldquoGEOSrdquo) available at httpsCRANR-projectorgpackage=rgeos R package version 04-2 2018

Bivand R Pebesma E and Gomez-Rubio V Applied spatialdata analysis with R Use R 2 edn available at httpwwwasdar-bookorg Springer New York 2013

Blondel E geometa Tools for Reading and Writing ISOOGCGeographic Metadata available at httpsCRANR-projectorgpackage=geometa R package version 04-0 2018a

Blondel E ows4R Interface to OGC Web-Services (OWS) avail-able at httpsCRANR-projectorgpackage=ows4R R packageversion 01-0 2018b

Bloumlschl G Sivapalan M Savenije H Wagener T and ViglioneA Runoff prediction in ungauged basins synthesis across pro-cesses places and scales Cambridge University Press Cam-bridge 2013

Bloumlschl G Hall J Parajka J Perdigatildeo R A P Merz BArheimer B Aronica G T Bilibashi A Bonacci O BorgaM Canjevac I Castellarin A Chirico G B Claps P Fi-ala K Frolova N Gorbachova L Guumll A Hannaford JHarrigan S Kireeva M Kiss A Kjeldsen T R KohnovaacuteS Koskela J J Ledvinka O Macdonald N Mavrova-Guirguinova M Mediero L Merz R Molnar P MontanariA Murphy C Osuch M Ovcharuk V Radevski I RoggerM Salinas J L Sauquet E Šraj M Szolgay J ViglioneA Volpi E Wilson D Zaimi K and Živkovic N Changingclimate shifts timing of European floods Science 357 588ndash590httpsdoiorg101126scienceaan2506 2017

Blum A G Archfield S A and Vogel R M On the probabil-ity distribution of daily streamflow in the United States HydrolEarth Syst Sci 21 3093ndash3103 httpsdoiorg105194hess-21-3093-2017 2017

Boessenkool B berryFunctions Function Collection Related toPlotting and Hydrology available at httpsCRANR-projectorgpackage=berryFunctions R package version 1170 2018

Boessenkool B Harrigan S Smith K and Klotz DUsing R in Hydrology EGU2017 Short Course Zenodohttpsdoiorg105281zenodo2554019 2017

Bond N hydrostats Hydrologic Indices for Daily Time Se-ries Data available at httpsCRANR-projectorgpackage=hydrostats R package version 026 2018

Brenning A Bangs D and Becker M RSAGA SAGAGeoprocessing and Terrain Analysis available at httpsCRANR-projectorgpackage=RSAGA R package version130 2018a

Brenning A Polakowski F and Becker M RPyGeo ArcGISGeoprocessing via Python available at httpsCRANR-projectorgpackage=RPyGeo R package version 100 2018b

Brunsdon C and Comber L An introduction to Rfor spatial analysis and mapping Sage Los Ange-les available at httpsuksagepubcomen-gbeuran-introduction-to-r-for-spatial-analysis-and-mappingbook241031 2015

BSC-CNS and Manubens N easyNCDF Tools to EasilyReadWrite NetCDF Files intofrom Multidimensional R Arrays

available at httpsCRANR-projectorgpackage=easyNCDFR package version 004 2017

Buytaert W topmodel Implementation of the Hydrological ModelTOPMODEL in R available at httpsCRANR-projectorgpackage=topmodel R package version 073 2018

Ceola S Arheimer B Baratti E Bloumlschl G Capell R Castel-larin A Freer J Han D Hrachowitz M Hundecha Y Hut-ton C Lindstroumlm G Montanari A Nijzink R Parajka JToth E Viglione A and Wagener T Virtual laboratories newopportunities for collaborative water science Hydrol Earth SystSci 19 2101ndash2117 httpsdoiorg105194hess-19-2101-20152015

Chamberlain S rnoaa ldquoNOAArdquo Weather Data from R availableat httpsCRANR-projectorgpackage=rnoaa r package ver-sion 084 2019

Chambers J M Programming with data A guide to the S lan-guage Springer Science amp Business Media New York USA469 p 1998

Chambers J M Extending R The R series Chapman andHallCRC Press Boca Raton London New York 2016

Chambers J M XRPython Structured Interface to ldquoPythonrdquoavailable at httpsCRANR-projectorgpackage=XRPython rpackage version 08 2017

Chambers J M XRJulia Structured Interface to Julia available athttpsCRANR-projectorgpackage=XRJulia R package ver-sion 077 2018

Chan C-h Chan G C H Leeper T J and Becker J rioA Swiss-army knife for data file IO r package version 05162018

Chang W and Borges Ribeiro B shinydashboard Create Dash-boards with ldquoShinyrdquo available at httpsCRANR-projectorgpackage=shinydashboard r package version 071 2018

Chang W Cheng J Allaire J Xie Y and McPherson J Shinyweb application framework for R 2015

Cheng J Karambelkar B and Xie Y leaflet Create InteractiveWeb Maps with the JavaScript ldquoLeafletrdquo Library available athttpsCRANR-projectorgpackage=leaflet R package version202 2018

Clark M P Slater A G Rupp D E Woods R A Vrugt J AGupta H V Wagener T and Hay L E Framework for Under-standing Structural Errors (FUSE) A modular framework to di-agnose differences between hydrological models Water ResourRes 44 12 2008

Coles S An Introduction to Statistical Modeling of ExtremeValues Springer Series in Statistics available at httpswwwspringercomgpbook9781852334598 Springer-Verlag Lon-don 2001

Conway J Eddelbuettel D Nishiyama T Prayaga S K andTiffin N RPostgreSQL R Interface to the ldquoPostgreSQLrdquoDatabase System available at httpsCRANR-projectorgpackage=RPostgreSQL R package version 06-2 2017

Copernicus Climate Change Service Climate Data Store availableat httpscdsclimatecopernicuseu 2018

Coron L Thirel G Delaigue O Perrin C and Andreacuteas-sian V The Suite of Lumped GR Hydrological Modelsin an R package Environ Modell Softw 94 166ndash171httpsdoiorg101016jenvsoft201705002 2017

Coron L Perrin C Delaigue O Thirel G and Michel CairGR Suite of GR Hydrological Models for Precipitation-

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 21: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2959

Runoff Modelling available at httpsCRANR-projectorgpackage=airGR R package version 101011 2018

Crameri F Geodynamic diagnostics scientific visualisationand StagLab 30 Geosci Model Dev 11 2541ndash2562httpsdoiorg105194gmd-11-2541-2018 2018

Csaacuterdi G and Frick H goodpractice Advice on R PackageBuilding available at httpsCRANR-projectorgpackage=goodpractice r package version 102 2018

Csaacuterdi G rhub Connect to ldquoR-hubrdquo available at httpsCRANR-projectorgpackage=rhub R package version 102 2017

Dee D P Uppala S M Simmons A J Berrisford P PoliP Kobayashi S Andrae U Balmaseda M A Balsamo GBauer P Bechtold P Beljaars A C M van de Berg L Bid-lot J Bormann N Delsol C Dragani R Fuentes M GeerA J Haimberger L Healy S B Hersbach H Hoacutelm E VIsaksen L Karingllberg P Koumlhler M Matricardi M McNallyA P Monge-Sanz B M Morcrette J-J Park B-K PeubeyC de Rosnay P Tavolato C Theacutepaut J-N and Vitart F TheERA-Interim reanalysis Configuration and performance of thedata assimilation system Q J Roy Meteor Soc 137 553ndash597httpsdoiorg101002qj828 2011

Delaigue O Coron L and Brigode P airGRteachingTeaching Hydrological Modelling with GR (Shiny InterfaceIncluded) available at httpsCRANR-projectorgpackage=airGRteaching R package version 0232 2018a

Delaigue O Thirel G Coron L and Brigode P airGR and air-GRteaching Two Open-Source Tools for Rainfall-Runoff Mod-eling and Teaching Hydrology in HIC 2018 13th InternationalConference on Hydroinformatics edited by Loggia G L FreniG Puleo V and Marchis M D vol 3 of EPiC Series inEngineering 541ndash548 EasyChair httpsdoiorg1029007qsqj2018b

des Riviecircres J and Wiegand J Eclipse A platform for integratingdevelopment tools IBM Syst J 43 371ndash383 2004

Do H X Gudmundsson L Leonard M and Westra S TheGlobal Streamflow Indices and Metadata Archive (GSIM) ndash Part1 The production of a daily streamflow archive and metadataEarth Syst Sci Data 10 765ndash785 httpsdoiorg105194essd-10-765-2018 2018

Dowle M and Srinivasan A datatable Extension ofldquodataframerdquo available at httpsCRANR-projectorgpackage=datatable R package version 1116 2018

Eddelbuettel D and Balamuta J J Extending extitR with ex-titC++ A Brief Introduction to extitRcpp PeerJ Preprints 5e3188v1 httpsdoiorg107287peerjpreprints3188v1 2017

Emerson J W and Kane M J biganalytics Utilities forldquobigmatrixrdquo Objects from Package ldquobigmemoryrdquo availableat httpsCRANR-projectorgpackage=biganalytics R pack-age version 1114 2016

ESRI ArcGIS Desktop Release 106 Redlands CA EnvironmentalSystems Research Institute ESRI Inc 2018

Essawy B Goodall J Zell W Voce D Morsy M Sadler JYuan Z and Malik T Integrating scientific cyberinfrastruc-tures to improve reproducibility in computational hydrologyExample for HydroShare and GeoTrust Environ Modell Softw105 217ndash229 httpsdoiorg101016jenvsoft2018030252018

European Commission Science with and for Society avail-able at httpeceuropaeuresearchparticipantsdatarefh2020wp2018-2020mainh2020-wp1820-swfs_enpdf 2015

Falcone J GAGES-II Geospatial Attributes of Gages forEvaluating Streamflow US Geological Survey Reston VAhttpsdoiorg10313370046617 2011

Faria J Grosjean P and Jelihovschi E Tinn-R-GUIEditor forR language and environment statistical computing available athttpsourceforgenetprojectstinn-r 2008

Federer C BROOK90 a simulation model for evaporation soilwater and streamflow 1995

Fuka D R Walter M T Steenhuis T S and EastonZ M SWATmodel A multi-OS implementation of theTAMU SWAT model available at httpsCRANR-projectorgpackage=SWATmodel r package version 059 2014

Garnier S viridis Default Color Maps from ldquomatplotlibrdquo avail-able at httpsCRANR-projectorgpackage=viridis r packageversion 051 2018

Gautier L rpy2 Python interface to the R language (embedded R)available at httpspypiorgprojectrpy2 python library version295 2018

GDAL Development Team GDAL ndash Geospatial Data Abstrac-tion Library Version 240 Open Source Geospatial Foundationavailable at httpswwwgdalorg 2018

Gesmann M and de Castillo D googleVis Interface between Rand the Google Visualisation API The R Journal 3 40ndash44 2011

Gilleland E and Katz R W extRemes 20 An ExtremeValue Analysis Package in R J Stat Softw 72 1ndash39httpsdoiorg1018637jssv072i08 2016

Giraud T and Lambert N cartography Create and Integrate Mapsin your R Workflow Journal of Open Source Software 4 54httpsdoiorg1021105joss00054 2016

GRASS Development Team Geographic Resources Analysis Sup-port System (GRASS GIS) Software Open Source GeospatialFoundation USA available at httpgrassosgeoorg 2019

Graul C leafletR Interactive Web-Maps Based on the LeafletJavaScript Library available at httpcranr-projectorgpackage=leafletR R package version 04-0 2016

Greenberg J A and Mattiuzzi M gdalUtils Wrappers for theGeospatial Data Abstraction Library (GDAL) Utilities avail-able at httpsCRANR-projectorgpackage=gdalUtils R pack-age version 20114 2018

Grothendieck G and Bellosta C J G rJython R interface toPython via Jython available at httpsCRANR-projectorgpackage=rJython r package version 00-4 2012

Guo H Big Earth data A new frontier in Earthand information sciences Big Earth Data 1 4ndash20httpsdoiorg1010802096447120171403062 2017

Gupta H V Perrin C Bloumlschl G Montanari A Kumar RClark M and Andreacuteassian V Large-sample hydrology a needto balance depth with breadth Hydrol Earth Syst Sci 18 463ndash477 httpsdoiorg105194hess-18-463-2014 2014

Guttag J V Introduction to computation and programming usingPython MIT Press Cambridge MA 2013

Hafen R and Continuum Analytics Inc rbokeh R Interfacefor Bokeh available at httpsCRANR-projectorgpackage=rbokeh R package version 050 2016

Hall D K and Riggs G A MODISTerra Snow Cover Daily L3Global 005Deg CMG Version 6 NASA National Snow and Ice

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 22: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2960 L J Slater et al R in Hydrology

Data Center Distributed Active Archive Center Boulder Col-orado USA httpsdoiorg105067MODISMOD10C10062016

Hannah D Demuth S van Lanen H Looser U PrudhommeC Rees G Stahl K and Tallaksen L Large-scale riverflow archives importance current status and future needs Hy-drol Process 25 1191ndash1200 httpsdoiorg101002hyp77942011

Harrigan S Hannaford J Muchan K and Marsh T J Desig-nation and trend analysis of the updated UK Benchmark Net-work of river flow stations The UKBN2 dataset Hydrol Res49 552ndash567 2018

Hart E M and Bell K prism Download data fromthe Oregon prism project R package version 006httpsdoiorg105281zenodo33663 2015

Heinkel R pyRserve A Python client to remotely access theR statistic package via network available at httpspypiorgprojectpyRserve python library version 091 2017

Heineman G T and Councill W T Component-based soft-ware engineering putting the pieces together Addison-WesleyBoston London xliii 818 p 2001

Hersbach H de Rosnay P Bell B Schepers D SimmonsA Soci C Abdalla S Alonso-Balmaseda M Balsamo GBechtold P Berrisford P Bidlot J-R de Boisseacuteson EBonavita M Browne P Buizza R Dahlgren P Dee DDragani R Diamantakis M Flemming J Forbes R GeerA J Haiden T Hoacutelm E Haimberger L Hogan R HoraacutenyiA Janiskova M Laloyaux P Lopez P Munoz-Sabater JPeubey C Radu R Richardson D Theacutepaut J-N Vitart FYang X Zsoacuteteacuter E and Zuo H Operational global reanalysisprogress future directions and synergies with NWP ERA ReportSeries available at httpswwwecmwfintnode18765 2018

Hester J lintr A ldquoLinterrdquo for R Code available at httpsCRANR-projectorgpackage=lintr R package version 103 2018

Hijmans R J raster Geographic Data Analysis and Modelingavailable at httpsCRANR-projectorgpackage=raster r pack-age version 26-7 2017

Hirsch R M and De Cicco L A User guide to Exploration andGraphics for RivEr Trends (EGRET) and dataRetrieval R pack-ages for hydrologic data chap A10 US Geological Survey Re-ston VA available at httpspubsusgsgovtm04a10 2015

Hosking J R M Regional Frequency Analysis using L-Momentsavailable at httpsCRANR-projectorgpackage=lmomRFA Rpackage version 32 2019a

Hosking J R M L-Moments R package version 28 2019bHufkens K ecmwfr Interface to the public ldquoECMWFrdquo Web Ser-

vices available at httpsgithubcomkhufkensecmwfr R pack-age version 002 2018

Hufkens K Basler D Milliman T Melaas E K and Richard-son A D An integrated phenology modelling framework inR modelling vegetation phenology with phenor Methods EcolEvol 9 1ndash10 httpsdoiorg1011112041-210X12970 2018

Hunt T ModelMetrics Rapid Calculation of Model Metrics avail-able at httpsCRANR-projectorgpackage=ModelMetrics rpackage version 122 2018

Hurley A Processing modelling and visualizinghydrological data in R (Version 111) Zenodohttpsdoiorg105281zenodo2553998 2018

Hurley A Slater L Thirel G Barker L Vitolo C Pros-docimi I and Harrigan S Using R in Hydrology at EGU2019httpsdoiorg105281zenodo3236979 2019

Hutton C Wagener T Freer J Han D Duffy C andArheimer B Most computational hydrology is not reproducibleso is it really science Water Resour Res 52 7548ndash7555httpsdoiorg1010022016WR019285 2016

Iannone R Allaire J and Borges B flexdashboard R Mark-down Format for Flexible Dashboards available at httpsCRANR-projectorgpackage=flexdashboard R package ver-sion 0511 2018

Ihaka R R Past and future history Computing Science and Statis-tics 30 392ndash396 1998

Ihaka R and Gentleman R R a language for data analysis andgraphics J Comput Graph Stat 5 299ndash314 1996

Kahle D and Wickham H ggmap Spatial Visualization with gg-plot2 The R Journal 5 144ndash161 2013

Kane M J Emerson J and Weston S Scalable Strategies forComputing with Massive Data J Stat Softw 55 1ndash19 2013

Keitt T colorRamps Builds color tables available at httpsCRANR-projectorgpackage=colorRamps r package version23 2012

Kelleher C and Wagener T Ten guidelines for effective data visu-alization in scientific publications Environ Modell Softw 26822ndash827 2011

Kilibarda M and Bajat B plotGoogleMaps the R-based web-mapping tool for thematic spatial data GEOMATICA 66 37ndash49 2012

Knaus J snowfall Easier cluster computing (based on snow)available at httpsCRANR-projectorgpackage=snowfall Rpackage version 184-61 2015

Knuth D E Literate programming Computer J 27 97ndash1111984

Koffler D Gauster T and Laaha G lfstat Calculation of LowFlow Statistics for Daily Stream Flow Data available at httpsCRANR-projectorgpackage=lfstat R package version 0942016

Kronenberg R and Oehlschlaumlgel L M Implementation of theBROOK90 model in R available at httpsgithubcomrkronenBrook90_R 2019

Kuhn M Wing J Weston S Williams A Keefer C Engel-hardt A Cooper T Mayer Z Kenkel B the R Core TeamBenesty M Lescarbeau R Ziem A Scrucca L TangY Candan C and Hunt T caret Classification and Re-gression Training available at httpsCRANR-projectorgpackage=caret R package version 60-81 2018

Kunst J highcharter A Wrapper for the ldquoHighchartsrdquo Libraryavailable at httpsCRANR-projectorgpackage=highcharterR package version 050 2017

Lawrence M and Wickham H plumbr Mutable and dynamic datamodels RStudio R package version 069 available at httpCRANR-projectorgpackage=plumbr 2018

LeDell E Gill N Aiello S Fu A Candel A Click C Kralje-vic T Nykodym T Aboyoun P Kurka M and MalohlavaM h2o R Interface for ldquoH2Ordquo available at httpsCRANR-projectorgpackage=h2o R package version 32008 2018

Li C JuliaCall Seamless Integration Between R and ldquoJuliardquo avail-able at httpsCRANR-projectorgpackage=JuliaCall R pack-age version 0160 2018

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 23: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2961

Light A and Bartlein P J The end of the rainbow Color schemesfor improved data graphics Eos Transactions American Geo-physical Union 85 385ndash391 2004

Lovelace R Nowosad J and Muumlnchow J Geocomputation withR Chapman and HallCRC Press Boca Raton London NewYork available at httpsgeocomprrobinlovelacenet 2019

Luraschi J and Allaire J r2d3 Interface to ldquoD3rdquo Visualizationsavailable at httpsCRANR-projectorgpackage=r2d3 R pack-age version 023 2018

Luraschi J Kuo K Ushey K Allaire J and The Apache Soft-ware Foundation sparklyr R Interface to Apache Spark avail-able at httpsCRANR-projectorgpackage=sparklyr R pack-age version 093 2018

MathWorks Company Overview available at httpswwwmathworkscomcontentdammathworkstag-teamObjectsccompany-fact-sheet-8282v18pdf 2018

McKiernan E Bourne P Brown C Buck S Kenall ALin J McDougall D Nosek B Ram K Soderberg CSpies J Thaney K Updegrove A Woo K and YarkoniT How open science helps researchers succeed eLife 5 1ndash19httpsdoiorg107554eLife16800 2016

Melsen L Torfs P Uijlenhoet R and Teuling A Comment onldquoMost computational hydrology is not reproducible so is it reallysciencerdquo by Christopher Hutton et al Water Resour Res 532568ndash2569 httpsdoiorg1010022016WR020208 2017

Metcalfe P Beven K and Freer J Dynamic TOPMODELA new implementation in R and its sensitivity to timeand space steps Environ Modell Softw 72 155ndash172httpsdoiorg101016jenvsoft201506010 2015

Metcalfe P Beven K and Freer J dynatopmodel Implemen-tation of the Dynamic TOPMODEL Hydrological Model avail-able at httpsCRANR-projectorgpackage=dynatopmodel Rpackage version 121 2018

Microsoft and Weston S foreach Provides Foreach Looping Con-struct for R available at httpsCRANR-projectorgpackage=foreach R package version 144 2017

Microsoft Corporation and Weston S doParallel Foreach Par-allel Adaptor for the ldquoparallelrdquo Package available at httpsCRANR-projectorgpackage=doParallel R package version1014 2018

Muenchow J Schratz P and Brenning A RQGIS Integrat-ing R with QGIS for Statistical Geocomputing The R Journal9 409ndash428 available at httpsrjournalgithubioarchive2017RJ-2017-067RJ-2017-067pdf 2017

Muumlller K Wickham H James D A and Falcon S RSQLiteldquoSQLiterdquo Interface for R available at httpsCRANR-projectorgpackage=RSQLite R package version 211 2018

Neil D Modern Vim Craft Your Development Environmentwith Vim 8 and Neovim Pragmatic Bookshelf avail-able at httpswwworeillycomlibraryviewmodern-vim9781680506006ar 2018

Neistsch S L Arnold J G Kiniry J R and WilliamsJ R ldquoSoil Water Assessment Tool Theoretical Documentation(version 2005)rdquo available at httpsswattamuedumedia1290swat2000theorypdf Grassland Soil and Water Research Labora-tory Temple Texas 2005

Neri A Villarini G Slater L J and Napolitano F Onthe statistical attribution of the frequency of flood events

across the US Midwest Adv Water Resour 127 225ndash236httpsdoiorg101016jadvwatres201903019 2019

Neuwirth E RColorBrewer ColorBrewer Palettes available athttpsCRANR-projectorgpackage=RColorBrewer r packageversion 11-2 2014

Ooms J The OpenCPU system Towards a universal interfacefor scientific computing through separation of concerns arXivpreprint arXiv14064806 2014

Ooms J V8 Embedded JavaScript Engine for R available athttpsCRANR-projectorgpackage=V8 2017

Ooms J hunspell High-Performance Stemmer Tokenizerand Spell Checker available at httpsCRANR-projectorgpackage=hunspell r package version 30 2018

Openshaw S and Abrahart R J GeoComputation vol 24 Tayloramp Francis London New York 2000

Pebesma E Simple Features for R Standardized Support for Spa-tial Vector Data The R Journal available at httpsjournalr-projectorgarchive2018RJ-2018-009indexhtml 2018a

Pebesma E stars Scalable Spatiotemporal Tidy Arrays avail-able at httpsCRANR-projectorgpackage=stars R packageversion 02-0 2018b

Pebesma E and Bivand R Classes and methods for spatial datain R R News 5 9ndash13 2005

Pebesma E Nuumlst D and Bivand R The R software environmentin reproducible geoscientific research Eos Transactions Ameri-can Geophysical Union 93 163ndash163 2012

Pedersen T L gganimate Create easy animations with ggplot2available at httpsgithubcomthomasp85gganimate 2018

Perkel J M A toolkit for data transparency takes shape Na-ture 560 513ndash515 httpsdoiorg101038d41586-018-05990-5 2018

Perrin C Michel C and Andreacuteassian V Improvement of a parsi-monious model for streamflow simulation J Hydrol 279 275ndash289 httpsdoiorg101016S0022-1694(03)00225-7 2003

Pierce D ncdf4 Interface to Unidata netCDF (Version 4 or Ear-lier) Format Data Files available at httpsCRANR-projectorgpackage=ncdf4 R package version 116 2017

Pohlert T trend Non-Parametric Trend Tests and Change-PointDetection available at httpsCRANR-projectorgpackage=trend R package version 111 2018

QGIS Development Team QGIS Geographic Information SystemOpen Source Geospatial Foundation Project available at httpqgisosgeoorg 2018

R Core Team R A Language and Environment for Statistical Com-puting R Foundation for Statistical Computing Vienna Austriaavailable at httpwwwR-projectorg 2018

Rigby R A and Stasinopoulos D M Generalized additive modelsfor location scale and shape with discussion Applied Statistics54 507ndash554 2005

Ritchie D M The development of the C language ACM SigplanNotices 28 201ndash208 1993

Roumldiger S Friedrichsmeier T Kapat P Michalke M RKWarda comprehensive graphical user interface and integrated develop-ment environment for statistical analysis with R J Stat Softw49 1ndash34 2012

Rossini A J Heiberger R M Sparapani R A Maechler Mand Hornik K Emacs speaks statistics A multiplatform mul-tipackage development environment for statistical analysis JComput Graph Stat 13 247ndash261 2004

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 24: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

2962 L J Slater et al R in Hydrology

RStudio Team RStudio Integrated Development Environment forR RStudio Inc Boston MA available at httpwwwrstudiocom 2018

Ryberg K R and Vecchia A V waterData Retrieval Analysisand Anomaly Calculation of Daily Hydrologic Time Series Dataavailable at httpsCRANR-projectorgpackage=waterData Rpackage version 108 2017

SAGA Development Team System for Automated GeoscientificAnalyses (SAGA GIS) Germany available at httpwwwsaga-gisorg 2008

Sanner M F Python a programming language for software in-tegration and development J Mol Graph Model 17 57ndash611999

Sarkar D Lattice Multivariate Data Visualization with R Use RSpringer New York available at httplmdvrr-forger-projectorg 2008

Schmidt-Walter P brook90r httpsdoiorg105281zenodo14336772018

Sievert C plotly for R available at httpsplotly-bookcpsievertme 2018

Slater L Harrigan S Gauster T Hurley A Thirel G and Vi-tolo C Using R in Hydrology EGU2018 Short Course Zenodohttpsdoiorg105281zenodo2554009 2018

Slater L J Singer M B and Kirchner J W Hydrologic ver-sus geomorphic drivers of trends in flood hazard GeophysRes Lett 42 370ndash376 httpsdoiorg1010022014GL0624822015

Sommerlot A Fuka D and Easton Z getMet Get Meteoro-logical Data for Hydrologic Models available at httpsCRANR-projectorgpackage=getMet R package version 032 2016

Souza R Ecohydmod Ecohydrological Modelling availableat httpsCRANR-projectorgpackage=Ecohydmod R pack-age version 100 2017

Stauffer R Mayr G J Dabernig M and Zeileis A Somewhereover the rainbow How to make effective use of colors in mete-orological visualizations B Am Meteorol Soc 96 203ndash2162015

Tapley B D Bettadpur S Ries J C Thompson P Fand Watkins M M GRACE measurements of massvariability in the Earth system Science 305 503ndash505httpsdoiorg101126science1099192 2004

Tennekes M tmap Thematic Maps in R J Stat Softw 84 1ndash39httpsdoiorg1018637jssv084i06 2018

Thieurmel B Marcelionis A Petit J Salette E and RobertT rAmCharts JavaScript Charts Tool available at httpsCRANR-projectorgpackage=rAmCharts R package version219 2018

Tuszynski J caTools Tools moving window statistics GIFBase64 ROC AUC etc available at httpsCRANR-projectorgpackage=caTools R package version 11711 2018

Urbanek S proj4 A simple interface to the PROJ4 cartographicprojections library available at httpsCRANR-projectorgpackage=proj4 R package version 10-8 2012

Urbanek S rJava Low-Level R to Java Interface available athttpsCRANR-projectorgpackage=rJava R package version09-10 2018

Vanderkam D Allaire J Owen J Gromer D and ThieurmelB dygraphs Interface to ldquoDygraphsrdquo Interactive Time Se-

ries Charting Library available at httpsCRANR-projectorgpackage=dygraphs R package version 1116 2018

Vantas K hydroscoper R interface to the Greek NationalData Bank for Hydrological and Meteorological Infor-mation The Journal of Open Source Software 3 1ndash7httpsdoiorg1021105joss00625 2018

Viglione A nsRFA Non-Supervised Regional Frequency Analy-sis available at httpsCRANR-projectorgpackage=nsRFA rpackage version 07-14 2018

Viglione A and Parajka J TUWmodel LumpedSemi-Distributed Hydrological Model for Educational PurposesR package version 10-2 2019

Villarini G Serinaldi F Smith J A and Krajewski W F On thestationarity of annual flood peaks in the continental United Statesduring the 20th century Water Resour Res 45 1ndash17 2009

Vitolo C hddtools Hydrological Data DiscoveryTools The Journal of Open Source Software 2 56httpsdoiorg1021105joss00056 2017

Vitolo C Fry M and Buytaert W rnrfa An R package to Re-trieve Filter and Visualize Data from the UK National RiverFlow Archive The R Journal 8 102ndash116 2016a

Vitolo C Wells P Dobias M and Buytaert W fuse An R pack-age for ensemble Hydrological Modelling The Journal of OpenSource Software 1 52 httpsdoiorg1021105joss000522016b

Wahlbrink S Eclipse Plug-In for R StatET [Software] 2016Wendt N gribr R interface for GRIB files using ECMWF ec-

Codes available at httpsgithubcomnawendtgribr r packageversion 122 2018

Wickham H testthat Get Started with Testing The R Journal 35ndash10 2011

Wickham H R packages organize test document and share yourcode OrsquoReilly Media Sebastopol available at httpr-pkgshadconz 2015

Wickham H feather R Bindings to the Feather ldquoAPIrdquo availableat httpsCRANR-projectorgpackage=feather R package ver-sion 031 2016a

Wickham H ggplot2 Elegant Graphics for Data Analysis Use RSpringer New York available at httpggplot2org 2016b

Wickham H tidyverse Easily Install and Load the ldquoTidyverserdquoavailable at httpsCRANR-projectorgpackage=tidyverse Rpackage version 121 2017

Wickham H and Hesselberth J pkgdown Make Static HTMLDocumentation for a Package available at httpsCRANR-projectorgpackage=pkgdown R package version 1302018

Wickham H Danenberg P and Eugster M roxygen2 In-LineDocumentation for R available at httpsCRANR-projectorgpackage=roxygen2 r package version 611 2018a

Wickham H Hester J and Francois R readr Read RectangularText Data available at httpsCRANR-projectorgpackage=readr r package version 131 2018b

Wilby R L Clifford N J De Luca P Harrigan S Hillier JK Hodgkins R Johnson M F Matthews T K R MurphyC Noone S J Parry S Prudhomme C Rice S P Slater LJ Smith K A and Wood P J The ldquodirty dozenrdquo of freshwa-ter science detecting then reconciling hydrological data biasesand errors Wiley Interdisciplinary Reviews Water 4 e1209httpsdoiorg101002wat21209 2017

Hydrol Earth Syst Sci 23 2939ndash2963 2019 wwwhydrol-earth-syst-scinet2329392019

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References
Page 25: Using R in hydrology: a review of recent developments and ... · 1 Introduction: the rapid rise of R in hydrology In recent decades, the hydrological sciences, like many other disciplines,

L J Slater et al R in Hydrology 2963

Wilkinson L The Grammar of Graphics Statistics and Comput-ing 1st edn Springer New York 1999

Wilson G Software carpentry getting scientists to write bettercode by making them more productive Comput Sci Eng 866ndash69 2006

Wilson G Software Carpentry lessons learned F1000Research3 available at httpssoftware-carpentryorglessons 2014

Winslow L A Hahn T H Princiotta S D Leach T H andRose K C Characterizing hydrologic networks Developing atool to enable research of macroscale aquatic networks EnvironModell Softw 104 94ndash101 2018

WMO Manual on low flow estimation and prediction Geneva2009

Wood S N Generalized additive models an introduction with RTexts in statistical science 2nd edn Chapman and HallCRCPress Boca Raton London New York 2017

Xie Y bookdown Authoring Books and Technical Documentswith R Markdown The R series available at httpsgithubcomrstudiobookdown Chapman and HallCRC Press Boca RatonLondon New York 2016

Xie Y knitr A General-Purpose Package for Dynamic ReportGeneration in R available at httpsyihuinameknitr R pack-age version 120 2018

Xie Y and Lesur R pagedown Paginate the HTML Output ofR Markdown with CSS for Print available at httpsCRANR-projectorgpackage=pagedown r package version 01 2019

Xie Y Hill A P and Thomas A blogdown Creating Websiteswith R Markdown The R series Chapman and HallCRC PressBoca Raton London New York available at httpsgithubcomrstudioblogdown 2017

Yee T W Stoklosa J and Huggins R M The VGAM Packagefor Capture-Recapture Data Using the Conditional LikelihoodJ Stat Softw 65 1ndash33 httpsdoiorg1018637jssv065i052015

Zambrano-Bigiarini M hydroGOF Goodness-of-fit functions forcomparison of simulated and observed hydrological time serieshttpsdoiorg105281zenodo840087 R package version 03-10 2017a

Zambrano-Bigiarini M hydroTSM Time Series Manage-ment Analysis and Interpolation for Hydrological Modellinghttpsdoiorg105281zenodo839864 R package version 05-1 2017b

Zeileis A Fisher J C Hornik K Ihaka R McWhite C DMurrell P Stauffer R and Wilke C O colorspace A Tool-box for Manipulating and Assessing Colors and Palettes arXiv190306490 arXivorg E-Print Archive available at httparxivorgabs190306490 2019

wwwhydrol-earth-syst-scinet2329392019 Hydrol Earth Syst Sci 23 2939ndash2963 2019

  • Abstract
  • Introduction the rapid rise of R in hydrology
  • The benefits and advantages of using R in hydrology
    • Democratizing open science and numerical literacy
    • Enhancing reproducible hydrological research and open science
    • Providing statistical tools for hydrology
    • Connecting R to and from other languages
    • Interacting with the R-Hydro community scientific resources and courses
      • R packages in a typical hydrological workflow
        • Setting up a repository and finding the right packages
        • Packages for retrieving hydro-meteorological data
        • Packages for reading manipulating and cleaning the data
        • Packages for extracting driving data spatial analysis and cartography
        • Packages for hydrological modelling
        • Packages for hydrological statistics
        • Packages for static and dynamic hydrological data visualization
        • Packages for creating presentations and documents
          • Challenges and solutions when using R in hydrology
            • Hydrological libraries documentation and vignettes
            • Integrated development environments (IDEs) facilitating the use of R
            • Big data and parallel computing challenges in hydrology
              • A roadmap for the future of R in hydrology
                • Sharing R code with the community
                • R packages as a driver of progress in hydrology
                • Harmonizing hydrological workflows
                • APIs hydrological data acquisition and provision
                • Teaching hydrology in R
                • Developing the community short courses help desks and meet-up events
                  • Conclusions
                  • Data availability
                  • Supplement
                  • Author contributions
                  • Competing interests
                  • Acknowledgements
                  • Review statement
                  • References