Learn to code and save time

Share:

From a young age, I’ve always gravitated toward science. With enthusiastic support from my dad, a hobbyist gardener, I remember growing tomato plants in different types of soil and observing their growth rate to test my hypothesis that tomatoes grown in an even balance of sand and clay would grow best. This project was my science fair entry in fourth grade. I didn’t win anything resume-worthy, but I had a great time talking to the judges about science, which was a win in my book.

Developing and testing hypotheses has become second nature as a graduate student, but now I’m dealing with different computer programs and software instead of tomato plants. One such software is called R, created by the R Project for Statistical Computing, was developed as an alternative to other statistical processing software such as Sigma Plot. R is unique among software options since it is an open-source program, where anyone and everyone can contribute to its development.

A plot created in R shows relative exposure of a living shoreline.
A plot of wind data from Easton, MD, created in R. These data inform calculations of relative exposure, a useful metric that helps inform living shoreline design. Plot: Erika Koontz.

Many people not have even heard of R, but you’ve likely heard of Microsoft Excel, which used to be my go-to software for managing and visualizing my datasets. Many Excel users likely share the frustration I experienced with creating plots that are not only visually appealing, but accurately convey results. I have always struggled to make aesthetically pleasing figures in Excel, and often find that they do not save correctly, causing me to waste hours of my time painstakingly recreating a figure. Until I learned about R and starting using it, working with data was my least favorite part of science. I’m happy to say that it is now my favorite because of R.

In addition to making some truly incredible plots with your coding, other people can replicate your exact outcomes when you share your code. Plots in Excel lack this easy reproducibility. If you made a plot in Excel, there isn’t an easy way for someone else to look at your data and re-make the plot without spending a chunk of time on it. In R, as long as you have the correct version of the software and tools loaded, the other person can re-make a complicated plot in a fraction of the time—perhaps in mere seconds!

R may be most well-known for its infinite customization, but it also has fantastic data processing abilities. The software requires that you learn a computer language in order to code and successfully make full use of its capabilities. I’ve used R to help me manage large datasets, since my master’s research is producing a lot of data. Some of the analyses I conduct on those data are very time-consuming if done by hand, like calculating fetch.

The Palinkas Staver lab team works to measure aspects of a wetland area along the water in Maryland.
Members of the Palinkas and Staver lab measuring and recording vegetation data in a living shoreline. Photo: Erika Koontz.

Fetch is a measurement of the distance where wind can travel unobstructed on open water. In my research on living shorelines, fetch is a critical metric that managers and planners use to determine if a living shoreline would be a good design for a section of shoreline. Too much fetch can create powerful wind-driven waves that erode the living shoreline, which is not the desired outcome. Calculating fetch involves making as many as 48 measurements around a single point on a shoreline to determine an average. If I am analyzing a handful of living shorelines, then automating that calculation is not necessary. I currently plan to analyze upwards of 100 living shorelines for fetch and could use a tool to make that process less time-consuming.

This is where R comes in. R did not have a tool that was included with the original software to calculate fetch by measuring those distances, but other R users have collaborated to develop a tool that does that. R has many features, but the most useful one is that the software was designed to be collaborative. Collaboration is an integral part of success in science. The saying goes: “If you want to go fast, go alone; if you want to go far, go together,” and this couldn’t be truer in the sciences. Success in science results from working together and using tools like R that work for you.

Top left image: A living shoreline on Tilghman Island, MD, that has a large fetch due to its proximity to the mainstem of the Chesapeake Bay. Photo: Erika Koontz

About Erika Koontz

Erika is a master’s student at the University of Maryland Center for Environmental Science Horn Point Laboratory, where she is advised by Cindy Palinkas and Lorie Staver. She is studying the impacts of a specific design of living shoreline on submersed aquatic vegetation (SAV) in Chesapeake Bay. She will also conduct research on bay-wide trends in shoreline erosion at living shorelines and seeks to understand changes that have occurred over the last century.

A native Marylander, Erika has found a lot to love and learn about the state known as “America in miniature.” She graduated from Washington College in Chestertown, Maryland, with a BA in Environmental Studies. Prior to starting graduate school, she used to work as a technician at the Smithsonian Environmental Research Center (SERC) in Edgewater, Maryland, studying methane emissions from wetlands. In her spare time, she enjoys triathlon, hiking, and gardening with native plants.

Learn more about this student: /fellows/2022/erika-koontz

The Blue Crab: Callinectes Sapidus

An essential resource for researchers, students, and managers.  Get your copy today!

pile of cooked crabs