### Basic use

First we load the peptools package. Note that we do not need to install it every time we use R, but we do need to load the package.

library(peptools)

The package includes a pepstations data object that includes metadata for each station, including lat/lon and bay segment. We can use the sf and dplyr package to make this a spatial data object, then plot it with mapview (you may need to install these packages if you don’t have them). Note that the peptools package has built-in mapping functions, this example just shows how to create a map from scratch.

library(sf)
library(dplyr)
library(mapview)

locs <- pepstations %>%
sf::st_as_sf(coords = c('Longitude', 'Latitude'), crs = 4326) %>%
dplyr::mutate(bay_segment = as.character(bay_segment))

mapview(locs, zcol = 'bay_segment', layer.name = 'Bay segment')   

The pepseg data object also included with the package shows the polygons for the bay segments.

mapview(pepseg)