Overview

In my work I would like to introduce some cities of RF with their foundation year and population, data will be taken from Wikipedia’s page List of cities and towns in Russia. It is possible to parse all this data but now I will manually fill dataframe with 18 cities, founded from 1135 to 1158 years A.D. This cities were founded mostly as fortresses, and current capital Moscow is just one of them. But then the period of feudal wars ended, their destinies were quite different. Now I will show their current population. The population and foundation year are different in the total table (Russian version of this Wiki page) and on the pages of every city - I will use the data given in table.

library(leaflet)
#The code which created dataframe was hided, here's the result:
cities
##                  name      pop     lat     lng year
## 1         Volokolamsk    23386 56.0200 35.5700 1135
## 2             Torzhok    44702 57.0200 34.5800 1135
## 3                Tver   403726 56.5128 35.5518 1135
## 4            Karachev    19715 53.0700 34.5900 1146
## 5             Kozelsk    18203 54.0200 35.4700 1146
## 6               Sevsk     7282 52.0900 34.2938 1146
## 7                Tula   501129 54.1200 37.3700 1146
## 8               Belev    13918 53.4800 36.0800 1147
## 9      Velikiy Ustyug    31664 60.4532 46.1814 1147
## 10            Vologda   301642 59.1300 39.5400 1147
## 11             Moscow 11514330 55.4521 37.3704 1147
## 12            Uglitch    34505 57.3200 38.2000 1148
## 13            Kasimov    33494 54.5700 41.2350 1152
## 14           Kostroma   268617 57.4600 40.5600 1152
## 15 Pereslavl-Zalessky    41923 56.4417 38.5122 1152
## 16            Dmitrov    61454 56.2048 37.3118 1154
## 17              Mglin     7916 53.0340 32.5054 1154
## 18         Gorohovetz    14015 56.1210 42.4133 1158

Map, version 1

cities %>%
  leaflet() %>%
  addTiles() %>%
  addCircles(weight = 1,
             radius = sqrt(cities$pop) * 30,
             label = cities$year)

Wow, something goes wrong! Cities’ latitude and longitude in the Wiki are in another format. I will change them a little to make my map more adequate, this time I will take coordinate from map service. Another option is to use any converter (for Moscow 55°45′21″ 37°37′04″ is equal to 55.7558°, 37.6177° and that is close to my coordinates chosen by random click on city center point on the map). Also, I will do something with my circles, why all of them are the same color? And I want to change their size, maybe a logarithmic scale with a multiplier?

cities2
##                  name      pop     lat     lng year
## 1         Volokolamsk    23386 56.0325 35.9522 1135
## 2             Torzhok    44702 57.0387 34.9758 1135
## 3                Tver   403726 56.8551 35.8857 1135
## 4            Karachev    19715 53.1252 34.9830 1146
## 5             Kozelsk    18203 54.0380 35.7767 1146
## 6               Sevsk     7282 52.1492 34.4864 1146
## 7                Tula   501129 54.1972 37.6233 1146
## 8               Belev    13918 53.8138 36.1358 1147
## 9      Velikiy Ustyug    31664 60.7668 46.2977 1147
## 10            Vologda   301642 59.2204 39.8818 1147
## 11             Moscow 11514330 55.7527 37.6244 1147
## 12            Uglitch    34505 57.5293 38.3224 1148
## 13            Kasimov    33494 54.9504 41.3966 1152
## 14           Kostroma   268617 57.7688 40.9430 1152
## 15 Pereslavl-Zalessky    41923 56.7388 38.8553 1152
## 16            Dmitrov    61454 56.3512 37.5210 1154
## 17              Mglin     7916 53.0598 32.8510 1154
## 18         Gorohovetz    14015 56.2020 42.6930 1158

Map, version 2

pal1 <- colorFactor(palette = c('orange3','yellow4','blue','red','cyan3','coral4','maroon'), domain = cities2$year)
cities2 %>%
  leaflet() %>%
  addTiles() %>%
  addCircles(weight = 1, 
             radius = log10(cities2$pop) * 5000,
             label = cities2$year,
             color = pal1(cities2$year),
             fillOpacity = .7
             ) %>%
  addLegend('bottomright',
            pal = pal1,
            values = cities2$year,
            title = 'Year of foundation:',
            opacity = .7)

Well, now all these cities are on their places, I see that all the data have to be verified before usage (if it is not your data and you believe in it). And I never will parse the Wikipedia (and any other web-site) without review and understanding data.

Hope you too, good luck!