Plotting in R with graphics

Introduction

The graphics package is included with the language, meaning you won’t need to import anything at the beginning of your file. It includes a ton of useful, variably-complex plots to use on your journey of data visualization.

Examples

Show the map with the Craiglist data from Indiana. (Some of the data points will be outside Indiana, but most of them will be in the State of Indiana.)

Click to see solution
myDF <- fread("/anvil/projects/tdm/data/craigslist/vehicles.csv",
              stringsAsFactors = TRUE, select = c(23:25))
subDF <- subset(myDF, (state=="in") & (!is.na(long)) & (!is.na(lat)))

points <- st_as_sf(subDF, coords=c("long", "lat"), crs=4326)
addCircleMarkers(addTiles(leaflet(subDF)), radius=1)