R Markdown
library(leaflet)
library(htmltools)
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
location <- data.frame(
lat = 41.0082,
lng = 28.9784,
popup_text = "Hagia Sophia, Istanbul"
)
passed_time <- format(Sys.Date() %m-% years(1), "%d. %B %Y")
show_time <- tags$div(
style = "background: rgba(255, 255, 255, 0.8); padding: 10px; border-radius: 5px; font-weight: bold; color: black;",
paste("Datenstand:", passed_time)
)
map_obj <- leaflet(data = location) %>%
addTiles() %>%
addMarkers(popup = ~popup_text) %>%
addControl(
html = as.character(show_time),
position = "topleft"
)
## Assuming "lng" and "lat" are longitude and latitude, respectively
map_obj