Welcome

This is the online home of Dealing with spatial data for Coastal and Marine Environment in R, a book on analysis and visualization of spatial data.

The book cover

Note: This book is now available online at https://lugoga.github.io/geomarine/

Inspired by bookdown and the Free and Open Source Software for Geospatial (FOSS4G) movement, this book is open source. This ensures its contents are reproducible and publicly accessible for people worldwide.

The online version of the book is hosted at my Github Account, where is updated regularly and new version of the book is knitted once the upadates are incorpoarated and status of the ‘build status’ are provided as follows:

Actions

This version of the book was built on 2021-01-17.

Preface

The book has been prepared for use with the course GI 612—GIS for coastal and Marine Environment at the Institute of Marine Sciences of the University of Dar es Salaam (IMS/UDSM). The course intends to equip student with skills for capturing, storing, querying, analyzing, displaying, reporting and disseminating coastal and marine spatial data. This course introduce briefly the concept of geographical information system (GIS) and its relevancy in helping decision making in the era of digital age.

What will you learn?

Practical of Spatial Data for Coastal and Marine Environment in R is a book with thirteen chapters aimed to introduce how to import, manipulate, analyze, and visualize geographic data with open source software. It is based on R—a statistical programming language that has powerful functions for data processing, manipulating, and visualizing spatial data. The book equips you with the knowledge and skills to tackle a wide range of issues in geographic context, including those with scientific, societal, and environmental implications. This book fits people from many backgrounds, who use Geographic Information Systems (GIS) in applying their domain-specific field. Our goal is that, after working through this material, students will not necessarily be expert in these methods and associated theory, but that they will develop an expanded toolkit and a greater appreciation for the wider world of data and statistical modeling.

Hope you enjoy taking the course and discovering more about geospatial data!

Audience

This book is primarily aimed for aquatic ecology, oceanography, limnology, and other fields that works with spatial and temporal data. Moreover, since the methods discussed in the book are applicable not only to aquatic data but also to many other fields that deal with spatial data, the book is also good reference for researchers and practitioners of other areas wishing to learn how to code and visualize this type of data. The concept in the book is also appropriate for undergraduate and postgraduate students, who collect data and analyse them for their research.

Acknowledgments

R represents an excellent tool for the analysis of spatial data. I would like to thank the R community and the developers and contributors of open-source software that enable reproducible data analysis. In particular, I would like to thank the developers of spatial packages, and the authors of ggplot2 (Wickham 2016) and sf (Pebesma 2018) for the great function they created for spatial and non-spatial data analysis and visualization. I would also like to thank the developers of leaflet (Cheng, Karambelkar, and Xie 2019) and tmpa (Tennekes 2018) packages, which enable interactive mapping and visualization in R. Also and the creation of Shiny (Chang et al. 2020), a package that allows creation of web applications that make a difference on how information is distributed and insights are communicated.

This book is written in R Markdown (Xie, Dervieux, and Riederer 2020) with bookdown (Xie 2016). I am grateful to developers of these packages, which made really easy to typeset this book. I would also like to express my sincere gratitude to the anonymous reviewers for their helpful comments that greatly improved the first version of this book. I also thank Tanzania Fisheries Research Institute for permission to use some of data for illustration in this book. I also thank the Institute of Marine Sciences of the University of Dar es Salaam for their suggestions and guidance throughout the preparation of this book.

0.1 Dedications

To my wife, Nyamisi, my daughter, Grace and my sons, Daniel and Ethan, for enduring so much typing during dinner. And to Glad, for enduring so many plots over coffee.

How this book came to being

The book was prepared and using R (R Core Team 2020) and bookdown (Xie 2020), a package based on Markdown syntax (Allaire et al. 2019) in Rstudio. Several other packages were also used for various task during book development. Diagrams were plotted using ggplot2 (Wickham, Chang, et al. 2020) and metR (Campitelli 2020) packages. The kableExtra package was used for making nicer table (Zhu 2020). Basemaps data were obtained from spData (Bivand, Nowosad, and Lovelace 2020). Demographic and economic data like population and Gross domestic Product from World Bank database were obtained through wbstats (Piburn 2020). Fish landings catches were obtained from rfisheries (Ram, Boettiger, and Dyck 2016). Oceanographic data were obtained from various sources and color used for mapping their distribution were obtained from oce package (Kelley and Richards 2020). The webex package was used to create the interactive web exercises (Barr and DeBruine 2019). All of this packages and software are free and open source.

About the author

Masumbuko Semba works at the School of Material, Energy, Water and Environment of the Nelson Mandela African Institution of Science and Technology located in Arusha, Tanzania. Semba received his bachelor’s in fisheries and aquaculture and his master of marine sciences from the University of Dar es Salaam, Tanzania. Semba is current doing a PhD in the department of physical oceanography at the Institute of Marine Sciences of the University of Dar es Salaam. Semba research focuses on understanding the surface current dynamics using drifter observations and satellite altimetry data to understand how ocean current in the Indian Ocean vary both in space and time. Semba holds extensive analytic skills using different programming languages including MATLAB, Python and R. His keen interest in coding resulted from power of programming in analytic skills and ability to glean insights from data.

Understanding a difficult facing scientist to analyse the data with programming, he developed a blog where he share his analytic concepts to the public. Semba has developed several data web-application that serve as data repository and exploration tool for Lake Tanganyika and Indian Ocean. These web application provide a platform to analyse marine and freshwater environmental data that vary both in space and time. Semba is active developing a package that is dedicated for marine and freshwater system in the WIO region. The packages is basically developed to help marine and freshwater scientist access a large and varied format of in-situ and satellite data in easy way. The package can be accessed and downloaded for installation in your machine from the wior package github link

Citation

For attribution, please cite this work as;

Semba M. (2021). Dealing with spatial data for Coastal and Marine Environment in R. Retrieve from "https://lugoga.github.io/geomarine/"

And the BibTex format is;

@misc{semba2021,
    author = {Masumbuko Semba },
    title = {Dealing with spatial data for Coastal and Marine Environment in R},
    ur = {https://lugoga.github.io/geomarine/},
    year = {2021}
}

References

Allaire, JJ, Jeffrey Horner, Yihui Xie, Vicent Marti, and Natacha Porte. 2019. Markdown: Render Markdown with the c Library Sundown. https://github.com/rstudio/markdown.

Barr, Dale, and Lisa DeBruine. 2019. Webex: Create Interactive Web Exercises in R Markdown. https://github.com/psyteachr/webex.

Bivand, Roger, Jakub Nowosad, and Robin Lovelace. 2020. SpData: Datasets for Spatial Analysis. https://nowosad.github.io/spData/.

Campitelli, Elio. 2020. MetR: Tools for Easier Analysis of Meteorological Fields. https://github.com/eliocamp/metR.

Chang, Winston, Joe Cheng, JJ Allaire, Yihui Xie, and Jonathan McPherson. 2020. Shiny: Web Application Framework for R. https://CRAN.R-project.org/package=shiny.

Cheng, Joe, Bhaskar Karambelkar, and Yihui Xie. 2019. Leaflet: Create Interactive Web Maps with the Javascript ’Leaflet’ Library. https://CRAN.R-project.org/package=leaflet.

Kelley, Dan, and Clark Richards. 2020. Oce: Analysis of Oceanographic Data. https://dankelley.github.io/oce.

Pebesma, Edzer. 2018. “Simple Features for R: Standardized Support for Spatial Vector Data.” The R Journal 10 (1): 439–46. https://doi.org/10.32614/RJ-2018-009.

Piburn, Jesse. 2020. Wbstats: Programmatic Access to Data and Statistics from the World Bank Api. https://github.com/nset-ornl/wbstats.

Ram, Karthik, Carl Boettiger, and Andrew Dyck. 2016. Rfisheries: Programmatic Interface to the Openfisheries.org Api. https://www.github.com/ropensci/rfisheries.

R Core Team. 2020. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

Tennekes, Martijn. 2018. “tmap: Thematic Maps in R.” Journal of Statistical Software 84 (6): 1–39. https://doi.org/10.18637/jss.v084.i06.

Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org.

Wickham, Hadley, Winston Chang, Lionel Henry, Thomas Lin Pedersen, Kohske Takahashi, Claus Wilke, Kara Woo, Hiroaki Yutani, and Dewey Dunnington. 2020. Ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics. https://CRAN.R-project.org/package=ggplot2.

Xie, Yihui. 2016. Bookdown: Authoring Books and Technical Documents with R Markdown. Boca Raton, Florida: Chapman; Hall/CRC. https://github.com/rstudio/bookdown.

Xie, Yihui. 2020. Bookdown: Authoring Books and Technical Documents with R Markdown. https://github.com/rstudio/bookdown.

Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook.

Zhu, Hao. 2020. KableExtra: Construct Complex Table with Kable and Pipe Syntax. https://CRAN.R-project.org/package=kableExtra.