Manipulating Maps and Images with R

By Joseph Schmuller

Part of R Projects For Dummies Cheat Sheet

Here are some packages and functions to help you get started using R to draw maps and to process images.

Packages and Functions for Plotting Maps and for Processing Images

Package Function What it does
maps map_data() Returns a data frame of latitudes and longitudes
ggmaps geocode() Returns latitude and longitude of a place-name
magick image_read() Reads an image into R and turns it into a magick object
magick image_resize() Resizes an image
magick image_rotate() Rotates an image
magick image_flip() Rotates an image on a horizontal axis
magick image_flop() Rotates an image on a vertical axis
magick image_annotate() Adds text to an image
magick image_background() Sets the background for an image
magick image_composite() Combines images
magick image_morph() Makes one image appear to gradually become (morph into) another
magick image_animate() Puts an animation into the RStudio Viewer window
magick image_apply() Applies a function to every frame in an animated GIF
magick image_write() Saves an animation as a reusable GIF