library("tidyverse")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:purrr':
##
## flatten
DF <- fromJSON("http://aws.rimesmedia.com:1880/nbcjobs")
library(dplyr)
library(tidygeocoder)
df <- DF %>% geocode(city = city, state = state, lat = latitude, long = longitude, method = "osm")
## Passing 35 addresses to the Nominatim single address geocoder
## Query completed in: 35.8 seconds
#df
library(leaflet)
### https://www.nbcunicareers.com/find-a-job?keyword=nbc#
peacockIcon <- makeIcon(
iconUrl = "http://rimesmedia.com/images/peacock.png",
iconWidth = 50, iconHeight = 30,
iconAnchorX = 25, iconAnchorY = 15
)
leaflet(data = df) %>% addTiles() %>%
addMarkers(~longitude, ~latitude, popup = ~as.character(paste(city, ', ', state)), label = ~as.character(count), labelOptions = labelOptions(noHide = T), icon = peacockIcon)
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored