29 Januar 2018

App Description and Short Manual

The app provides an interactive drilldown analysis to statistics on countries and cities.
Start your analysis with the country table to the left and sort or filter the rows. The city table to the right will update to reflect your country filters providing a drilldown analysis.
In the bottom half of the screen you can switch between charts and maps. Both, charts and maps, always update to match the currently displayed countries and cities in the tables.
You can also select multiple rows in the tables by clicking on them. Selected countries and cities will get highlighted in the charts and maps.
All charts and maps are interactive and provide tooltip and display control through the selection of the chart axes or the map layers. The 3D-chart can be rotated freely.
This is my first shiny app and serves rather as playground for trying out possibilities with dataTables, plotly, and leaflet than providing a useful application.

Data Preparation and Tables

I use data sets from the tmap package: World and metro. These data sets are of class "Spatial" (sp). This is an older format and I first convert them to simple features (sf) using the sf package. I also add ids for the cities and reshape this data to get a tidy data representation.

The resulting tables are shown on the next slide. The country table has a row for every country in the world with associates ids (iso_a3), names, and some statistics. The city table lists the largest cities in the world with population estimates from 1950 to 2030 in the long format. The last slides shows one of the interactive charts in the app as example.

Enjoy exploring the world!
https://polytropos.shinyapps.io/WorldExplorer/

Data Tables

head(country_sf, 3)
## Simple feature collection with 3 features and 12 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 1075788 ymin: -2340336 xmax: 6474206 ymax: 5306915
## epsg (SRID):    NA
## proj4string:    +proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
##   iso_a3        name continent                   economy    area  pop_est
## 1    AFG Afghanistan      Asia 7. Least developed region  652860 28400000
## 2    AGO      Angola    Africa 7. Least developed region 1246700 12799293
## 3    ALB     Albania    Europe      6. Developing region   27400  3639453
##   pop_est_dens gdp_md_est gdp_cap_est life_exp well_being HPI
## 1           44      22270         784       49          5  37
## 2           10     110300        8618       51          4  33
## 3          133      21810        5993       77          5  54
##                         geometry
## 1 MULTIPOLYGON (((6449718 471...
## 2 MULTIPOLYGON (((1531585 -77...
## 3 MULTIPOLYGON (((1650306 530...
head(city_sf_tidy, 3)
## Simple feature collection with 3 features and 5 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 3.04197 ymin: -8.83682 xmax: 69.17246 ymax: 36.7525
## epsg (SRID):    4326
## proj4string:    +proj=longlat +datum=WGS84 +no_defs
##   city_id city_name country_name iso_a3 continent
## 1       1     Kabul  Afghanistan    AFG      Asia
## 2       2   Algiers      Algeria    DZA    Africa
## 3       3    Luanda       Angola    AGO    Africa
##                    geometry
## 1 POINT (69.17246 34.52889)
## 2   POINT (3.04197 36.7525)
## 3 POINT (13.23432 -8.83682)

Example Chart