Session 1: County-level data

1.1 Getting familiar with the data

Open the County-Level Information (DHEC Data) file with Excel and explore its content.

There are over 4,000 records of data by county regarding several categories and indicators for the past 4 years (2014 to 2018).

Notice the variation on Number_Type.

Question: How can you easily know in Excel all of the variations in Category, Indicator, and Number_Type?

Answer

Data Issues

Apart from several indicators and number types all mixed together in one column, there are other data issues that we should be aware of, but will not explore in depth in this beginning session. According to the 2018 SC Drug Overdose Report:

- Total Drug Overdose Deaths involving selected drug categories are identified by additional multiple cause-of-death codes. This is why we will focus part of our analysis in all opioid overdose deaths instead of total drug overdose deaths.

- Total Prescription Drugs Overdose Deaths category includes both opioid and non-opioid prescription drugs.

- All Opioid Overdose Deaths includes both legal and illegal opioids.

- Drug overdose deaths may involve multiple drugs; therefore, a single death might be included in more than one category when describing the number of drug overdose deaths involving a specific drug.

For example, a death that involved both heroin and fentanyl would be included in the following categories:

- deaths involving heroin

- deaths involving fentanyl

- deaths involving opioids

- deaths involving prescription drugs

1.2 Bringing tabular data in Tableau

Tableau is a data visualization and analytics platform used by thousands of companies to understand their data. Tableau offers an intuitive, drag-and-drop user interface to build interactive graphs in order to quickly generate insights.

Tableau Desktop is part of the Tableau platform that allows you to work locally in your computer to create your own visualizations.

Tableau Public is a free cloud tool that is intended for people who want to publish information, accessible to anyone. There are both a Desktop and Online components.

In your computer, open Tableau. The Connect window appears.

Tableau can be used with several data formats including Excel files, text files, and more robust databases and big data files. In this workshop, we will be using Tableau with Excel files.

In the Connect window, select Microsoft Excel. Navigate to the folder where you saved the workshop data. Select the County-Level Information (DHEC Data) file. Click Open.

This will bring the data connection window, where we can choose which sheets of the file to use. Since our file only has the one spreadsheet, it is automatically loaded into the canvas.

In the lower pane, we can see a preview of the data. Here we can do basic operations with our columns. For example, the column Age only has one value (All Ages), so we choose to hide it. Same with Gender Category. To do this, click the column name for Age. Hit Control, and select the Gender Category column as well. Right-click and select Hide. Repeat the same process for the Column State.

1.2.1. Data Types in Tableau

The blue icon on top of each column name represents the data type that Tableau has assigned to that column. Notice any problem with any of the columns?

You can change the data type of the Data Year column by clicking on the icon and choosing a different type (Date or Number-whole) in the drop-down menu.

1.2.2 Choosing the Type of Connection

In the top right corner, you can choose to connect your data Live or to Extract it. Live connections are best suited for datasets that are constantly changing.

If your data does not change often and your goal is to eventually publish your data, then let Tableau import the data into its fast engine and choose Extract, which is what we will use for our datasets in this session. If it asks you to save the extracted data to your computer, follow the prompts.

1.3 The Tableau Interface

Now that we have the data ready for visualization, it is time to create a new chart. For that, go to the bottom left corner, and click Go to Worksheet (or Sheet 1).

The Save Extract As window will pop up. Save your extracted file. The worksheet window appears. The way the data columns are split and the associated definitions that make up the Tableau workspace can be a little bit daunting at the beginning.

Notice how the data columns are split into two types:

- Dimensions: for categorical data

- Measures: for continuous data

Drag the County Name dimension to the Columns self and the Number/Rate measure to the rows shelf. Let's analyze the components of the interface.

Shelves are areas where fields are placed to create views.

Pills are fields that have been places on one or more shelves.

Marks provide you with control over how the data is displayed in the view.

Save your Tableau workshop by going to File - Save. Give it a name: Opioids by county by YourName

1.4 Understanding your data structure through graphs

Before creating any chart, first, let's use Tableau's visualization tools to better understand the structure of our data.

Clean the current worksheet by selecting the Clear Sheet button.

Now, similarly to what we did in Excel with Pivot Tables, we are going to explore the structure of our data by dragging the Category, Indicator, and Number Type dimensions to the Rows shelf.

Now you can see how all these variables work together. For example, rate per 100,000 is only available for the death category, and rate is only available for infectious disease and prescriptions (RX).

If necessary, expand the view of the chart so you can see the entire indicator's name.

- If we want to know know many records are associated with each combination, drag the Number/Rate measure to the Abc column. Notice how the SUM(Number/Rate) pill gets added to the Text Mark.

- We can change this number to average, median, or count. Each one answers a different question. Talk to the person next to you for a couple of minutes to discuss possible scenarios for each one of them. At the end, change it to median.

- Drag the Category dimension to the color mark. Notice the change.

Rename your current Sheet (Sheet 1) by double-clicking on its name and change it to Indicators. Save your Tableau workbook.