R

Alongside Python, R is one of the commonly used programming languages in geography research due in part to the large collection of geospatial packages that have been developed with it along with it’s broad adoption for scientific computing.

The easiest and most recommended approach for getting started with R is to download the installer from CRAN:

The following resources will provide general introductions to R and its applications within data science, so any of them can be useful for learning the basics of R.

Geospatial Books

Extending GIS Software

Geospatial Libraries/Packages

A relatively comprehensive list of packages can be found in the R section of Awesome Geospatial.

For a closer analysis on some of the most popular R packages for spatial data analysis, consider reviewing the following journal article.

Additionally, you can identify packages from the following CRAN task views.

Interactive Visualizations and Dashboards

Dashboard libraries enable you to create interactive visualizations from your R code, which can be hosted on sparsely-resourced servers and shared as web applications.

Increasing Performance

Similar to Python, R isn’t considered a particularly fast programming language. For many geography-based researchers, development workflows first focus on developing code that performs accurate analysis and then later improving the code as needed to ensure the analysis runs as efficiently as possible in both local and HTC environments before finally adapting code to work in an HPC environment if needed.

Code Quality Tools

Formatting

Sometimes writing code can get a bit messy. Formatters, like styler, can automatically reformat your code to make it cleaner and easier to read while following a set of standards and best practices.

Note

RStudio includes a formatting tool via Code > Reformat Code

Linting

Using a static analysis tool, or linter, is a common best practice among programmers that helps identify mistakes when writing code by ensuring that you follow the correct syntax and a guiding set of best practices.

Testing Framework

Similar to type checking, unit testing can be a helpful tool when writing large and complex scripts or programs. Testing frameworks enable you to define tests that can run over your functions and ensure they are following expected behavior in a range of practical scenarios.

Benchmarking

When writing code, there is often a wide array of ways in which a task can be completed. Benchmarking your functions can help you find the most efficient approach possible. This is particularly important when writing scripts and programs that will be used on large datasets and/or on high performance computers.