This is an assignment for Developing Data Products course, which is a part of Coursera’s Data Science and Data Science: Statistics and Machine Learning Specializations.

Assignment Instructions

Create a web page using R Markdown that features a map made with Leaflet.

Submission

My map is going to show my four top favourite places in Tallinn, Estonia.

Data Prepartion

There are points with geo-coordinates of my 4-top favourite places in Tallinn. The places includes their types in different colours, and links to their sites.

library(leaflet)
lats<-c(59.44493, 59.4402,59.43842, 59.43632)
longs<-c(24.80621,24.7948,24.79102, 24.79583)
places<- c('Lauluväljak', 'Kadrioru park', 'Kadrioru loss',
           'Kumu Kunstimuuseum')
sites <- c("https://lauluvaljak.ee/en", "http://kadriorupark.ee/en",
           "https://kadriorumuuseum.ekm.ee/en/",
           "https://kumu.ekm.ee/en/")
        
types<- c('Square', 'Park', 'Museum','Museum')
typecolour<- c("blue","green","brown","brown")

Plotting

Welcome to Tallinn!

map<- data.frame(lat=lats, lng=longs) %>% leaflet() %>%
        addTiles() %>%
        addCircleMarkers(color=typecolour,
                         popup = paste("<a href='", sites, "'>",
                                       places,"</a>" ,sep = "")) %>%
        addLegend(labels = types[1:3],
                  colors=c("blue","green","brown")) %>%
        addProviderTiles(providers$OpenStreetMap)
map