How to change datasources in Tableau

At work I’m using Tableau as a tool for visualizing data with the possibility for the user to filter the data he’s looking at. So the user doesn’t need to program. He can use just is mouse which is great for people who don’t know exactly how to work with data. All this typical data mangling is hidden below the glamorous surface.

Unfortunatly for me the creation of these dashboards is done also by mouse clicking. When you’re used to program it’s a little bit annoying to click here and there to do something you could do with five lines of code…

An example is changing the datasources of a Tableau workbook. Let’s say we’ve created a workbook with lots of worksheets which are composed to several dashboards.

Now we want to apply all these calculations and visualizations to another set of datasouces with the same structure but with different content.

Iterating over the lines of a data.frame with purrr

I sometimes have a function which takes some parameters and returns a data.frame as a result. Then I have a data.frame where each row of it is a set of parameters. So I like to apply the function to each row of the parameter-data.frame and rbind the resulting data.frames.

There are several ways to do it. Let’s have a look:

A New Animation of the Spreading of SARS-CoV-2 in Germany

Update 2020-11-28: I’ve updated the resulting image with data until Nov 27, 2020.

In August I published first an animation of the spreading of SARS-CoV-2 in Germany.

Some days ago I found a similar visualization for Austria by Matthias Schnetzer. But he uses a different scale. His worst colour is for 150 incidents per 100,000 residents during the last 7 days. (I used 50 as last value of the scale.)

He also provides a link to his code He uses a little different way for plotting. So I thought I should update my animation using his way.