Exploring swiss taxes

Mathieu C.
2020-01-24

What's that about?

Welcome to this short presentation about the shiny webapp available at the following address.

The idea of the webapp is to let the user (that's you!) select which informations he/she wants displayed on the right in an interactive and easy way.

The data comes from the swiss Federal Office of statistics.

The database used relates information about swiss taxpayers.

The original dataframe can be found at this address.

NB: The format is a .px file that required the use of the pxR package.

Database transformation and structure

The variables were translated in english and are :

  • year -> the year that value is from
  • employement status -> the employement status of the group observed
  • civil status -> the civil status of the group observed
  • canton -> the canton (state) in which the observation was made (there's 26 of them)
  • observation unit -> the unit of the value and the nature of the observation
  • value -> the actual value of the observation (unit depends on the previous variable)

Except from that, the variables were left as is.

A look at the database

Here are some sample rows from the database.

      year   employment.status      civil.status
9662  2004          pensioners single with child
11899 2015 independent workers      other status
12179 2015 independent workers single with child
14050 2010           inactives single with child
14574 2016           employees      other status
15244 2014           employees      other status
                canton          observation.unit      value
9662          Obwalden taxable income in 1000CHF     2065.6
11899           Aargau taxable income in 1000CHF   418990.7
12179           Ticino taxable income in 1000CHF    67897.9
14050         Obwalden          total tax in CHF    66542.0
14574              Zug          total tax in CHF 88895565.0
15244 Basel-Landschaft          total tax in CHF 51354018.0

Why use the app?

Of course, one could plot a subset of the dataframe like below : plot of chunk unnamed-chunk-2

However, this method has several disadvantages :

  • Requires R code knowledge for the process
  • Readability is not very good with so many colors
  • Allowing only a few cantons to show up would require some typing
  • Switching between categories observed is tedious
  • Direct comparaisons are hard to pull off

Additionnal Informations

My attempt was to make the database as easy to manipulate as possible.

When on the app page, you just have to select the options in the left panel and the main panel on the right will display the graph you required. You can then use the graph options from plotly to further zoom/investigate the data. They are on the graph itself, in the upper-right corner.

I hope you enjoy it!

–>direct link to the shiny app