leaflet is not working

Does anyone is having problems with leaflet maps today?

The following code is only printing the selected points but not the map (in my local sesion).

library(tidyverse)
library(AirMonitor)
library(leaflet)

#33.190102669587205, -117.29447966349346
year2020 <- NULL
year2020 <- monitor_loadAnnual(year = 2020)

colnames(year2020$meta)

locations <- data.frame(longitude = year2020$meta$longitude,
latitude = year2020$meta$latitude,
city = year2020$meta$city)

locations2 <- locations %>%
filter( latitude < 34 &
longitude < -125)

leaflet(locations2) %>%
addCircles()

My session info is:

sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Mexico.utf8 LC_CTYPE=Spanish_Mexico.utf8 LC_MONETARY=Spanish_Mexico.utf8 LC_NUMERIC=C LC_TIME=Spanish_Mexico.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] leaflet_2.1.1 AirMonitor_0.2.2 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6
[11] tidyverse_1.3.1

loaded via a namespace (and not attached):
[1] tidyselect_1.1.2 haven_2.5.0 geodist_0.0.7 colorspace_2.0-3 vctrs_0.4.1 generics_0.1.3 htmltools_0.5.2
[8] yaml_2.3.5 utf8_1.2.2 rlang_1.0.3 pillar_1.7.0 glue_1.6.2 withr_2.5.0 DBI_1.1.3
[15] dbplyr_2.2.1 lambda.r_1.2.4 modelr_0.1.8 readxl_1.4.0 lifecycle_1.0.1 MazamaTimeSeries_0.2.5 munsell_0.5.0
[22] gtable_0.3.0 cellranger_1.1.0 futile.logger_1.4.3 rvest_1.0.2 htmlwidgets_1.5.4 tzdb_0.3.0 fastmap_1.1.0
[29] crosstalk_1.2.0 fansi_1.0.3 broom_1.0.0 formatR_1.12 scales_1.2.0 backports_1.4.1 jsonlite_1.8.0
[36] fs_1.5.2 hms_1.1.1 digest_0.6.29 stringi_1.7.6 grid_4.2.1 cli_3.3.0 tools_4.2.1
[43] magrittr_2.0.3 futile.options_1.0.1 crayon_1.5.1 pkgconfig_2.0.3 ellipsis_0.3.2 xml2_1.3.3 MazamaCoreUtils_0.4.10
[50] reprex_2.0.1 lubridate_1.8.0 assertthat_0.2.1 httr_1.4.3 rstudioapi_0.13 R6_2.5.1 compiler_4.2.1

I think you’re just missing addTiles() your final call
https://rstudio.github.io/leaflet/basemaps.html

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.