The RGDAL package is used by R and RStudio to plot maps. Under Linux you may encounter one or two errors when trying to install the package:
Error: gdal-config not found. The gdal-config script distributed with GDAL could not be found.
configure: error: proj_api.h not found in standard or given locations. ERROR: configuration failed for package ‘rgdal’
You experience these errors because R in Linux installs the packages from source (rather than a ready-compiled binary) and you need additional libraries to compile RGDAL. Essentially, the packages libgdal-dev and libproj-dev are required and may be missing. To install them on an Ubuntu system open a terminal (CTRL+ALT+T) and type (or copy and paste):
sudo apt-get update && sudo apt-get install libgdal-dev libproj-dev
To ensure you package lists are up to date and then installs the required packages. Once these are installed on your system you can install the RGDAL package by running the following code inside R: