r-packages

A list of R packages I find useful

This list of R packages covers my main line of work: spatial data analysis, climate and hydrology. You’ll find mostly pacakges dedicated to plotting (I use ggplot2), netCDF data handling, mapping and spatial features (mostly sf-related) and development. Additionally, there are some interesting links on these topics collected at the bottom of the page.

Feel free to suggest a package by opening an issue in this repo!

GENERIC PLOTTING

Package Description
ggplot2 The best plotting package, period
tmap Advanced plotting generic program using both lattice and ggplot
tmaptools Extension to the tmap package
marmap Import, analyse and plot bathymetries
cartography Thematic cartography

GGPLOT2 EXTENSIONS (www.ggplot2-exts.org)

Package Description
patchwork Combining different plots on a grid
cowplot Combining different plots on a grid, annotations, subplots,
ggally Plot matrixes, glyphs, combining plots
ggiraph Interactive gg plots
ggsn North and scale symbols for ggplot
ggspatial Spatial helpers, north and scale symbols, backgrounds
gganimate Animate gg graphics
tweenr Interpolate animation of gg graphics
transformr As tweenr, for polygons
ggalt Several nice scales and geoms, horizon charts, lollipop charts, densities, encircling lines, splines
ggradar Radar charts with ggplot
ggrepel Repelling labels
ggextra Marginal plots
ggquiver Add arrows and vectors on top of plots
multiscales Multivariate color scales. Similar in scope to tricolore
ggridges Ridgeline plots
ggpmisc Adding tables, ridges and valleys, fit equations with R2, density filters
ggforce {Zoomed and paginated} facets; {arcs, circles, gradient links, sina (violin-like)} plots, additional transformations
ggbeeswarm better scatterplots without overlaps
gghalves Half-half geometries
ggpirate pirate plots, a kind of advanced boxplots
ggpol A fem geometris, some of which linked to politics (parliament plots)
ggperiodic Periodic plots, such as 360degree and 24-h circle plots without jumps in coord_polar
ggstatsplot Functions to provide ggplots with added very detailed statistical information
metR Awesome package for easier analysis of metereological fields. Provides, other than EOF functions and the like, some amazing ggplot2 extensions for contouring, highlighting areas, subsetting, better scales nd more
ggnewscale Multiple scales with ggplot2; very simple to use! Similar to relayer
relayer Multiple scales with ggplot2, similar to ggnewscale
sugrrants Another ggplot2 extension providing timeseries analysis, and in particular calendar plots
ggisoband ggplot2 interface to the isoband library which can generate contour lines and polygons

COLORS AND SCALES

Package Description
RColorBrewer Provides Cynthia Brewer color palettes, integrates with ggplot2
scales Create color scales, integrates some missing features in ggplot2
colorpiler Additional color palettes, including Brewer’s. ggplot integration supported
colourpicker  
colourvalues  
colorspace Excellent HCL-based color palettes, also provides ggplot scales
colormap Generate colors from color palettes defined in Node.js’s colormap module; integrates with ggplot2
scico Colour palettes developed by Fabio Crameri
tricolore tricolor multivariate color scales, integrated with ggplot2. Similar in scope to multiscales

INTERACTIVE PLOTTING/MANIPULATION (http://www.htmlwidgets.org/showcase_leaflet.html)

Package Description
plotly Interactive plotting with D3, can also import ggplot plots
mapview Visualize spatial data using leaflet, works with sf and raster
plainview Previously provided with mapview, provides interactive (raster) images rendered as plain unprojected canvas
cubeview Previously provided with mapview, inteactive 3D visualization of raster data
leafpm Edit spatial data using mapedit, using a different editor
mapdeck R interface to Deck.gl and Mapbox, interactive 2d/3d maps
leaflet R interface to the leaflet JS library for interactive maps
leafgl Faster web gl rendering of features on leaflet maps - currently pre-alpha
rthreejs Interactive 3D scatterplots and globe plots using three.js
timevis nteractive timeline/timeseries visualizations
r2d3 Low-level D3.js visualizations
rAmCharts Interactive charts based on amcharts.js
dygraphs Yet another graphical timeseries plotter
vegalite ggplot2-like “bindings” for Vega-Lite
vegawidget Low level access to the Vega-Lite API, to render as htmlwidgets for shiny integration

DASHBOARDS

Package Description
shiny The go-to R package for interactive web interfaces, dashboards
advanced-shiny Not a package, but helpful resource for shiny hints
shinyjs Set of functions to complete missing shiny features
shinyBS Add additional functionality and interactivity to your shiny applications (last commit 2016)
shinyWidgets Set of additional shiny widgets
shinydashboard  
flexdashboard Easy interactive dashboards for R. Also integrates with rmarkdown

PLOTTING OVER TILED (WEB) MAPS, OBTAINING AND HANDLING SPATIAL BOUNDARIES, DIRECTIONS AND MAP DATA (maps, DEMs)

Package Description
ggmap Oldish interface to add google-like maps to ggplot
googleway Provides a mechanism to access various Google Maps APIs, including plotting a Google Map from R and overlaying it with shapes and markers, and retrieving data from the places, directions, roads, distances, geocoding, elevation and timezone APIs.
RgoogleMaps  
tiler Package to adapt background maps to a given CRS, ready to plot with leaflet
rnaturalearth Go-to package for obtaining boundaries and other spatial features data from naturalearthdata
rnaturalearthhires High resolution data for rnaturalearth
rnaturalearthdata Additional resolution data for rnaturalearth
rworldmap  
rworldxtra  
maps  
mapdata  
maptools  
rmapzen A Mapzen API client for R
mapsap An interface to some Google Maps APIs, returning sf objects
elevatr Access elevation data from several web services
stplanr Excellent package for transport and route planning, includes interface to the graphhopper direction and route planning API
graphhopper-r Another interface to the graphhopper direction and route planning API
mapsapi Interface to the Google Maps direction, geocode and distance APIs, integrates with sf, requires API key
gmapsdistance Another interface to the Google Maps distance matrix API; requires API key

SPATIAL DATA MANIPULATION

Package Description
sf Simple features for R
lwgeom sf bindings to the liblwgeom library
rmapshaper very fast and accurate polygon simplification, extraction of lines from polygons, and much more
smoothr Smooth polygons using different methods, integrates with sf
geometa Write, read & validate geographic metadata; extends sf
areal Facilitate areal interpolation (with weights) between sf polygons and objects
concaveman A very fast 2D concave hull algorithm
gstat Variogram modelling, spatio-temporal kriging, gridding; supports sf and stars objects
raster The de-facto standard raster data manipulation tool in R. Has TONS of features but its desing is somewhat old, and new features are not added frequently
stars A new package which integrates extremely well with sf and provides some advantages over raster, at the cost of features
gdalcubes_R New pacakge to deal with GDALcubes, which are collections of Earth Observation images as on demand data cubes (or multidimensional arrays)
velox Fast raster extraction and manipulation. Very fast. Integrates with raster and sf

NETCDF DATA HANDLING

Package Description
ncdf4 The main low level package for dealing with netCDF data. Has some drawbacks
RNetCDF alternative package to ncdf4. Works better, but the syntax and usability are terrible
tidync modern, tidyverse-like way to access netcdf data
ncmeta Easy metadata retrieval from netCDF files
netcdfgeom Reads and writes geometry data (points, lines and polygons) to/from netCDF files

UNIT HANDLING

Package Description
units Deal with units in a clear and automatic way, using udunits2
udunits2 R bindings to the Unidata udunits2 library

HANDLING TABLES

Package Description
dplyr Best tool for general data prying in tydy format (column = variable, row = observation)
data.table Similar in scope to dplyr, but in general quite a bit faster, albeit with less clear grammar. Also provides the best text file reader, fread
dtplyr Translational layer between dplyr and data.table: the ease of use of the former with the speed of the latter!
tidyr Set of functions to help tidy data
purrr Enhanced functional programming with R, via map* functions
vroom Super-duper fast reading of delimited files

DEALING WITH TIME

Package Description
lubridate Tidy date handling package
tsibble Tools to integrate tibbles with tidy time manipualtion (aggregation, etc.). Also provides rolling means and integrates with futures!
feasts Extend tsibble with additional functions, compositions, and visualisations; used by fable
fable Methods and tools for displaying and analysing univariate time series forecasts; uses feasts
sweep Extends the broom tools for performing tidy forecasts using forecast. An alternative to fable
zoo  
xts  
forecast The primary package for time series forecasting
PCICt 360-day calendars

DATABASES

Package Description
dbplyr dplyr interface for (also online) databasesl; uses DBI
RSQLite R interface to SQL
DBI Common interface between R and Database Management Systems

PARALLEL COMPUTING

Package Description
future modern parallel execution API supporting several backends. Execute R code asyncronously in the background, potentially with many cores
promises Asyncronous programming. Especially useful applied to multi-user Shiny apps or Shiny apps with long and slow tasks. Uses future.
future.batchtools future extension to provide PBS, SLURM… access via batchtools
future.apply Parallel apply integration with futures
furrr purrr… in the future
multidplyr A parallel backend to dplyr
foreach Simple parallelised for loops
batchtools Provides tools to interact with batch schedulers such as SLURM, TORQUE, OpenPBS…
rslurm Yet another tool to submit and manage SLURM jobs
pbapply Progress bars with mcapply and parLapply made easy. Adds a significant overhead
pbmcapply Parallel apply with progress bars, uses future. Fastest progress bar implementation by far, but only ptovides lapply and mapply
clustermq Very low overhead multiprocessing via ZeroMQ. Has live load balancing

LOGGING

Package Description
futile.logger Best logger there is
tryCatchLog Wrapper to futile.logger for catching standard warnings and errors
assertr Error controls in magrittr pipelines
progressr Framework for reporting progress, works with shiny, futures and more

DEVELOPMENT

Package Description
profvis Profile your code, and visualise performance interactively
styler Style and beautify your R code
optparse Best package for parsing input
reprex Easily create reproducible examples for SO, GitHub, etc.
testthat de facto standard R package for testing packages and functions
usethis Invaluable tools to automate tasks related primarily to the creation of R pacakges
pkgdown Build website (static html documentation) for your package
remotes Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
fs Provide cross platform filesystem operations, combines well with dplyr and purrr
rcpp R interface to C++

RSTUDIO

Package Description
addinslist List of useful R studio addins

MISC

Package Description
drake Toll for reproducible research: define your planned workflow, rerun only what changed
knitr Elegant, flexible, and fast dynamic report generation
rmarkdown Generate documents including code and plots
broom Tidy and prepare for plotting the output of common model functions / fits
forcats Tidy tools for handling factors
nml R interface to Fortran namelists
reticulate use Python via R
tidytext  
colorout colorize your R terminal
glue Handy replacement for paste()
stringr Better string handling
readr Fast and friendly tidy way to read rectangular data (like csv, tsv, and fwf)
skimr Very nice package for computing and showing better summary statistics. Very, very nice.
eurostat Access, search and download the Eurostat database

TASK VIEWS