The following data set was used from https://www.kaggle.com/
library(readr)
income <- read_csv("~/4143/income.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## Country = col_character(),
## Latitude = col_double(),
## Longitude = col_double(),
## Incomeperperson = col_number()
## )
income
## # A tibble: 213 x 4
## Country Latitude Longitude Incomeperperson
## <chr> <dbl> <dbl> <dbl>
## 1 Afghanistan 34.0 65.5 NA
## 2 Albania 40.7 20.1 1915
## 3 Algeria 28.6 2.64 2232.
## 4 Andorra 42.5 1.59 21943.
## 5 Angola -12.8 17.8 1381
## 6 Antigua and Barbuda 17.6 -61.8 11894.
## 7 Argentina -33.2 -64.3 10749.
## 8 Armenia 40.6 44.4 1327.
## 9 Aruba 12.5 -70.0 NA
## 10 Australia -24.6 134. 25250.
## # ... with 203 more rows
This data set provides the average Income per person for each country around the whole world with a currency set as US Dollars
str(income)
## spec_tbl_df [213 x 4] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ Country : chr [1:213] "Afghanistan" "Albania" "Algeria" "Andorra" ...
## $ Latitude : num [1:213] 34 40.7 28.6 42.5 -12.8 ...
## $ Longitude : num [1:213] 65.53 20.08 2.64 1.59 17.81 ...
## $ Incomeperperson: num [1:213] NA 1915 2232 21943 1381 ...
## - attr(*, "spec")=
## .. cols(
## .. Country = col_character(),
## .. Latitude = col_double(),
## .. Longitude = col_double(),
## .. Incomeperperson = col_number()
## .. )
income = income[!is.na(income$Country),]
income = income[!is.na(income$Incomeperperson),]
we dropped any missing values
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.0.5
income %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup= ~as.character(Incomeperperson) , clusterOptions=markerClusterOptions())
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively