I am a new r and leaflet user, and I find that when I run the code for my leaflet map, the map just loads forever. I never get an error. When running the code without trying to color by data, the map takes a good ten minutes to load, but eventually does.
I am having the same issue with knitting.
I haven't had these sort of issues in any of my other work.
Here is the code:
```{r setup, echo = FALSE, warning = FALSE, message = FALSE,
error = FALSE, cache = TRUE}
knitr::opts_chunk$set(echo = FALSE)
library(leaflet)
library(tidyverse)
library(rgdal)
crime <- read_rds("r_4_tidy.rds")
rf_map <- readOGR(dsn = "/Final_Project/RUS_adm", layer =
"RUS_adm1")
rf_map <- spTransform(rf_map, CRS("+init=epsg:4326"))
rf_map <- merge(rf_map, crime, by = "ID_1", duplicateGeoms =
TRUE)
domain <- rf_map@data %>%
filter(YEAR == "1990") %>%
select(CRIMESHARE)
coloring <- colorNumeric(palette = "Blues",domain = domain)
rf_map %>%
leaflet() %>%
addProviderTiles(provider = "CartoDB") %>%
addPolygons(weight = 1,
#label = NAME,
color = ~coloring(CRIMESHARE))
Thanks!