Module #9: Datawrapper

Datawrapper is one of the best tools if you have no experience. It's easy to learn but can produce attractive charts. It offers a free plan, but you have to pay for more customized charts.

First Datawrapper Chart
https://academy.datawrapper.de/category/141-general


DataWrapper
Tutorials
Get inspired: DataWrapper chart gallery
School of Data: DataWrapper tutorial
Adam Marton Datawrapper Training


Automatic chart updates: How to publish charts with external data sources
https://academy.datawrapper.de/article/60-external-data-sources
Adam:

Datawrapper has good instructions on how to upload your own map here: https://academy.datawrapper.de/article/145-how-to-upload-your-own-map


The general process, or at least the workflow I use, is:

1. Compress your shapefile into a zip archive.
2. Go to mapshaper.org and import your zip archive.
3. Your map needs to use the WGS-84 projection or Datawrapper won't accept it. To put the map in that projection, hit the spacebar in mapshaper to enter the console, and enter proj wgs84
4. If you want to use labels for your map's polygons, you'll need to set interior points. In the console, enter    each "cx=$.innerX, cy=$.innerY"
5. You can also simplify the precision of the polygons on your map (hello, Chesapeake Bay) to drive down the file size of the map you're about to export. Hit the simplify button at the upper right, check the box for prevent shape removal, hit apply, and drag the slider to the right. I usually simplify down to around 50% and the map looks pretty unaffected. Your results may vary.
6. Hit the export button and choose TopoJSON as the file format.
7. Back in Datawrapper, start a new map project, click the or Upload Map button, and upload your TopoJSON file. 


From here, the process to finish your map is identical to creating any other Datawrapper map.


To go even further with a custom map, you can upload a TopoJSON that has a polygon layer for places like precincts and municipalities, and an outer boundary line layer for things like county or state boundaries. For instance, this election map has 240 municipalities in the much-discussed Philadelphia suburbs, as well as 60-plus wards for the city of Philadelphia. It also needed to have thicker lines to show county boundaries as a reference point for readers, or else all the polygons would be one large blob. Here's an example using another election map: https://www.inquirer.com/politics/election/philadelphia-presidential-votes-suburban-county-ward-map-20201109.html


You start by uploading a multi-layer TopoJSON. To do that, import a polygon shapefile and a line shapefile into mapshaper.org. Make sure you apply the correct projection and set the interior points for both layers. After you export as a TopoJSON and bring it into Datawrapper, hit the toggle switch for Additional options (advanced). "Regions" are your polygons and choose "Outer borders" to set the thick boundary lines.


Anyway, that's a new Datawrapper trick that I just picked up for our election maps.




John


Module #10: R and R Studio – The Basics

R and R Studio




Install R and R Studio. This is free and open source software. It is not large and doesn't tax the memory a lot. R runs on Windows, Mac and Linux, but this course is designed for the Mac version. If you use Windows, there may be variations in the lessons and instructions. Please see me for questions. Installing R is a two-step process: 1) Install R, the actual program 2) Install RStudio, a common interface 1) Download the most recent version of R for Mac:
https://mirrors.nics.utk.edu/cran/bin/macosx/R-4.0.2.pkg
--If you have a Windows computer, go to:
https://mirrors.nics.utk.edu/cran/bin/windows/base/R-4.0.2-win.exe
Accept all of the default settings for Mac. 2) Install RStudio, the interface we use to manage and create R code. Download the open source edition of R Studio desktop and follow the prompts to install it.
https://rstudio.com/products/rstudio/download/#download
Good instructions for installing R
http://www.machlis.com/R4Journalists/download-r-and-rstudio.html
Good overview of the program
https://docs.google.com/presentation/d/1O0eFLypJLP-PAC63Ghq2QURAnhFo6Dxc7nGt4y_l90s/edit#slide=id.p
Start Here
Basic tutorial on R:
https://profrobwells.github.io/Guest_Lectures/Intro_To_R/R1_Intro-to-R.html

Download the code and try it yourself
(Left click, download, remove.txt extension)
https://github.com/profrobwells/CovidFall2020/raw/master/Exercises/R1_Intro%20to%20R.Rmd


Reading
Machlis, Sharon. Practical R for Mass Communications and Journalism. Chapman & Hall/CRC The R Series. 2018. ISBN 9781138726918 https://www.amazon.com/gp/search?keywords=9781138726918 

Ch. 1, Introduction
Ch. 3, See How Much You Can Do in a Few Lines of Code 
Chapter 2: Get Started With R in a Few Easy Steps Here is the link to the firts six chapters for free
http://www.machlis.com/PracticalR4Journalism/index.html 


Advanced Corner
--Import Arkansascovid.com data and summarize Washington County trends
The master file
Ch 1 & 2 of Machlis: Key Points
Reproducible research Repetitive tasks in modern newsrooms. 
Employment reports, crime stats, budgets 

Variables - an R object 
Assignment operator <- Case sensitive 
Vector: A vector can only have one type of data - all integers, all strings 
Dataframe - like a spreadsheet 
Save files - Don’t save workspace: because all of your variables will be stored and re-loaded the next time you launch RStudio. 
It’s too easy to forget about previously stored variables that can interfere with later work,
Software packages: tidyverse, rio, pacman
Data Types and R
Machlis: 2.4.2 Data types you’re likely to use often
Reference: Logical Operators in R

Beginner’s guide to R: Introduction

https://www.computerworld.com/article/2497143/business-intelligence/business-intelligence-beginner-s-guide-to-r-introduction.html

RStudio IDE Easy Tricks You Might’ve Missed

https://rviews.rstudio.com/2016/11/11/easy-tricks-you-mightve-missed/

How Do I?

https://smach.github.io/R4JournalismBook/HowDoI.html

Packages

https://smach.github.io/R4JournalismBook/packages.html

 Download R and RStudio

http://www.machlis.com/R4Journalists/download-r-and-rstudio.html

You can download the most recent version of R at https://www.r-project.org/, which is the home of R (formally known as the R Project for Statistical Computing). The R-project home page usually includes information about the latest versions of R. Don’t be put off by the sometimes odd nicknames for R versions, such as “Very, Very Secure Dishes” and “Bug in Your Hair” – the software is much more useful than you might assume from the nicknames. (The whimsical version names come from various Peanuts cartoons.)

There should also be a prominent link to download R. Click that download option and you should be taken to CRAN, the Comprehensive R Archive Network, and a list of CRAN servers, called mirrors, around the world. Pick a server and choose the precompiled binary distribution for your operating system. Once the file finishes downloading, install it like any other software program – run the .exe for Windows or .pkg for Mac.

You should be fine accepting all the Mac defaults. On Windows, you’ll need to decide whether you want the 32- or 64-bit R version. (Unless you’ve got a pretty old system, chances are you’ll want 64-bit.)

This is all you need to start running R, but I strongly recommend also installing RStudio, a free platform designed to make it easier and more enjoyable to create and run R code. Head to RStudio.com and under products, look for RStudio and then RStudio Desktop (not Server), and download the free Open Source Edition version for your operating system. This, too, installs like a typical software program

Important Reference Materials
Data Structures in R-1wd5uem
Data Importing-t7pkq5
Importing CSVs-1w8mk8d
ggplot2-cheatsheet-19yp3zd

Module #6: Writing About Data

Writing Style Notes
 
Writing style notes
Don’t use this “respectively” construction. 
It confuses the readers and leads to data errors.
Other private trade schools also made the top 10 list, such as Philander Smith in Little Rock and Bryan University in Rogers, with increases of 81 percent and 74 percent respectively.
 
.ITT Technical Institute, the University of phoenix, Philander Smith College and Bryan University are all classified as private schools and are the top four schools with graduated student loan debt in the state. Their debt has increased 106 percent, 102 percent, 81 percent and 74 percent respectively since 2012.

Common Errors – Math
Percent vs Percentage Point
At Lyon College, 67 percent of non-first-generation students paid back their loans within five years, while only 53 percent of first-generation students did the same, which results in a 14 percent POINT difference. The median debt for both types of students was the same though, at $12,000.
You mean “percentage point.” 14 percent of 67 is 9.4.
Steve Doig – MathCrib-Doig

AP Style with Numbers

Module #3: Tableau

This module addresses:
–Downloading instructions for Tableau
–Getting started tutorial with video
–Building a basic COVID data chart with video and transcript
–Using filters and calculations with video and transcript
–Tutorial on Tableau calculations with video
–Proper formatting of a filter bar in Tableau, video
Links to additional Tableau Tutorials

Dashboards and Embedding Tableau Public in WordPress

Maps in Tableau

Tableau Download and License

Instructions for downloading Tableau Desktop

Download the latest version of Tableau Desktop and Tableau Prep Builder here

Click on the link above and select “Download Tableau Desktop” and “Download Tableau Prep Builder”. On the form, enter your school email address for Business E-mail and enter the name of your school for Organization.

Activate with your product key:  TC7L-F1E2-1BB0-33F3-5B82 

The download is for your personal computer. You will need to free up hard drive space and have sufficient memory. 
In my experience, you need at least 15 gb free hard drive space and 4 gb ram – it will be slow but it will run with that.

Already have a copy of Tableau Desktop installed? Update your license in the application: Help menu → Manage Product Keys

Are your students new to Tableau? Share our free Data Analytics for University Students guide to help them get started.

Students can continue using Tableau after the class is over by individually requesting their own one-year license through the Tableau for Students program here.

Need help? Find answers to frequently asked questions here.

Introduction to Tableau

Tableau Tutorial: Do This on Your Own

getting_started_transcript

Video
http://www.tableau.com/learn/tutorials/on-demand/getting-started

Dataset for the Tutorial:
global-superstore-orders-2016

Build Your First Tableau Chart – Deaths by Counties

Build a basic Covid chart. 
Covid Data to Jan 7 
1) Use the master_file_jan7.csv 

2) Create a folder on your computer for the semester: Data_Spring21. 
Put all of your class assignments and data in that folder. 
Piut master_file_jan7.csv in that folder 

3) Tableau: Connect | To A File | Text file | master_file_jan7.csv 
--this loads master_file_jan7.csv into Tableau 

4) Data Interpreter (top left column, under "Files") 

5) Check the file formats. 
--Are Words as ABC?   
--Are the Numbers as #?  

6) New Worksheet. Click Sheet 1 (bottom left) 

6) Drag County Nam to rows. 

7) Drag Deaths to columns. Check that measure is SUM 

8) Deaths to colors.      
--Click colors. Green-Red diverging. Reverse colors 

9) Drag total deaths to labels 

10) Filter for a date in time      
--Date to Filter. Individual date. Pick Jan. 7, 2021     
--Total now should read 3,926 deaths for Arkansas_all_counties 

11) Sort Descending. See toolbar, sorting icon, down arrow 

12) Formatting.     
--Headline: Click "Sheet 1". Write a headline Your end product should look like the chart below: 

13) Export a jpg version of your chart    
--Worksheet | Export | Image 

14) Engage in excessive self-congratulatory behavior. 
This chart was filtered to show counties with deaths 25 and greater

Formatting a Graphic

Filters and Calculations

 Using Filters:
1) Drag County Nam to Filters, click OK
2) On the County Filter, click down arrow, show filter. It will appear on the right column as a list of county names
3) On the right column, down arrow, select Multiple Dropdown
4) Edit Title and Type some instructions to your readers: 
"Select Your County
1) Select All to clear
2) Select your county"

 
Add a calculation rate: Deaths Per 10,000
1) Duplicate Sheet 1 
  --Left Click on the tab, duplicate
  --This copies your whole work to a new sheet
2) Calculate a Deaths Per 10,000
   --Click on Total Deaths - down arrow | Create | Calculated Field
   --Name the Calculation "Deaths Per 10,000"
   Divide Total Deaths into Population:
   --Add a Division Symbol after ([Deaths]/[Population])*10000
  
3) Drag Deaths Per 10,000 to Columns. 
   --Remove Total Deaths
   --Sort
4) Check your colors and labels. 
   --Drag Deaths Per 10,000 to Colors
   --Drag Deaths Per 10,000 to labels
  
4) Headline, Format Legends, Export jpg

Your Turn

Create calculated fields and make the following charts:
--Tested/population percentage for the most recent five days.
--Active cases per 10,000 residents
--A stacked bar chart with Ever on a Vent and Ever Hospitalized

Post on a Google Doc, include link in your weekly memo.

More on Tableau, Basic Excel Skills: FBI Data

More Tableau and Excel skills training: FBI Data

https://profrobwells.github.io/ArkPressWomen/FBICrime_2019.html

Tableau Calculations

Calculations sample workbook
Calculations video
Introduction to Calculations Transcript
  Table Calculation: Add a new column that adds 
 
Table Calculation: Add a new column divides graduate debt into enrollment
–In Measures Data Tab, Left Click on GRAD_DEBT_MDN, Create Calculated Field
–Put in this formula: sum[GRAD_DEBT_MDN]/[UGDS]
–Rename This as: Grad Debt Per Capita Enrollment
Drag INSTNM to Rows
#Grad Debt Per Capita Enrollment to Columns
Format with a Title, add appropriate annotations.
Color the graphic, include labels.


Showing Context – Total In Tableau
https://onlinehelp.tableau.com/current/pro/desktop/en-us/calculations_totals_grandtotal_turnon.htm#Agg
DL-by-Delinquency-Location-2gms0o8

Format Numbers in Tableau
https://help.tableau.com/current/pro/desktop/en-us/formatting_specific_numbers.htm

How to Tweak A Filter to Display Properly

Additional Tableau Tutorials

Dashboards and Embedding Tableau Public in WordPress

Maps in Tableau –

Dual Axis

Tableau Dual Axis chart
http://kb.tableau.com/articles/howto/dual-axis-bar-chart-multiple-measures


https://twitter.com/ArkansasCovid/status/1354572963962626048

Use this data source
https://wordpressua.uark.edu/datareporting/files/2021/02/active-cases-jan-27.xlsx


Example:
https://prod-useast-a.online.tableau.com/t/datareportinguofa/views/01272021datagraphic-GG_16117891922660/Sheet1?:showAppBanner=false&:display_count=n&:showVizHome=n&:origin=viz_share_link


Date to Columns
Active Cases Total to Rows
Confirmed Active Cases to Rows
Select Confirmed Active Cases "Green Pill", down arrow: Dual Axis Chart 

Change to Lines
Marks Card
SUM(Active Cases) to Line (down arrow from Automatic)

Change to Circles
SUM(Confirmed Cases) to Line (down arrow from Automatic)

Colors
Marks Card
SUM(Confirmed Cases)
Remove Active cases from color and drag Confirmed cases to color. 
Change color to purple

Align the Y axes:
(You have to do this in Tableau Desktop)
Left click, synchronize axis

More documentation

http://kb.tableau.com/articles/howto/dual-axis-bar-chart-multiple-measures

Your Turn:
Build a dual axis chart with the vaccine data: All_Doses_Received and All_Doses_Given
https://github.com/Arkansascovid/Main/blob/master/vaccine.csv

By Wednesday's class.


Dashboards – Embed Tableau in WordPress

Embed Tableau in WordPress

–Post on WordPress.
Create a new post
Use Divi Builder, the Purple box above the formatting bar
Insert columns, pick a full row
Insert module, pick </> Code
Paste your Tableau Public embed code in the Content box
Scroll down, change the Admin Label to My Mind-Blowing Tableau Graphic (or something more humble). Save and Exit
Change Page Layout (upper right corner) to Fullwidth. Publish
Revel in your nerd powers

Building a Dashboard

Building a Dashboard
 
Transcript for building a Tableau dashboard

 Interactive Graphics
 Tableau Interactive Graphics
Dashboards with Poverty Data.
Sizing and Formatting. Navigation from Dashboard to Actual Graphic.
Simplicity in Design for Dashboard,
Space for Central Element.
Filters: Basic Filters and Filter as Sheet
 
Basic Filter: Applies to One Worksheet
–Click upper righthand menu on graphic, see Filters, select the appropriate data source. Here it would be total incomes under $25,000.
–Filter is created and placed at the bottom of graphic. You can format and move the filter.
–Drag by tab in upper center of filter object. Move it to the top of the filtered graphic.
“Super Filter”: Add a Filter to Control All Cities on Worksheet
Filters on Dashboards
When we click through a filter, we see that by default, it only applies to the view it came
out with. We can make this filter apply to the entire dashboard.
–Click on the filter (down triangle icon), open the menu.
–Apply to Worksheets, select “all related data sources”
Now when we make a selection, it applies to the whole dashboard
Similarly, we can make a view act as a filter for the dashboard. Click on the view to bring
up the header bar, and click the filter icon. Now if we select a header such as Second
Class, all the relevant views are filtered.

Exercise: Format Workbook for A Phone
A majority of our readers will view these stories on their phones. For the Fall 2017 Veterans Health Care project, some 70 percent of the readership was on a mobile device. Schleuss said the Los Angeles Times receives about 55 percent of its traffic on mobile devices.
Let’s format this workbook for mobile. The design choices will be radically different.
–Duplicate your workbook
–Design it with the mobile template on the left: See Upper Left Tab: Dashboard: Device Preview. Switch to Phone
–Before doing any radical surgery to your graphics, consider duplicating them and bringing in the new versions into the mobile template.
 

 
 Dashboard Design Concepts
 DashBoard Design
Version 1
Created by ravindra kumar on May 10, 2013 10:35 AM. Last modified by ravindra kumar on May 10, 2013 10:41 AM.
Role  :- 1)Strategic  2)Analytical  3)Operational
 
1.Dashboards for strategic purposes
The primary use of dashboards today is for strategic purposes. The popular “executive dashboard,” and
most of the dashboards that support managers at any level in an organization, are strategic in nature. They
provide the quick overview that decision makers need to monitor the health and opportunities of the
business.
Dashboards of this type focus on high‐level measures of performance, including forecasts to light
the path into the future. Although these measures can benefit from contextual information to clarify the
meaning, such as comparisons to targets and brief histories, along with simple evaluators of performance
(for example, good and bad), too much information of this type or too many subtle gradations can distract
from the primary and immediate goals of the strategic decision maker.
 
2. Dashboards for analytical purposes
Dashboards that support data analysis require a different design approach. In these cases the information
often demands greater context, such as rich comparisons, more extensive history, and subtler performance
evaluators. Like strategic dashboards, analytical dashboards also benefit from static snapshots of data that
are not constantly changing from one moment to the next. However, more sophisticated display media are
often useful for the analyst who must examine complex data and relationships and is willing to invest the
time needed to learn how they work. Analytical dashboards should support interactions with the data, such
as drilling down into the underlying details, to enable the exploration needed to make sense of itthat is, not
just to see what is going on but to examine the causes. For example, it isn’t enough to see that sales are
decreasing; when your purpose is analysis, you must be made aware of such patterns so that you can then
explore them to discover what is causing the decrease and how it might be corrected. The dashboard itself,
as a monitoring device that tells the analyst what to investigate, need not support all the subsequent
interactions directly, but it should link as seamlessly as possible to the means to analyze the data.
 
3.Dashboards for operational purposes
When dashboards are used to monitor operations, they must be designed differently from those that
support strategic decision making or data analysis. The characteristic of operations that uniquely influences
the design of dashboards most is their dynamic and immediate nature. When you monitor operations, you
must maintain awareness of activities and events that are constantly changing and might require attention
and response at a moment’s notice. If the robotic arm on the manufacturing assembly line that attaches
the car door to the chassis runs out of bolts, you can’t wait until the next day to become aware of the
problem and take action. Likewise, if traffic on your web site suddenly drops to half its normal level, you
want to be notified immediately.
 
As with strategic dashboards, the display media on operational dashboards must be very simple. In the
stressful event of an emergency that requires an immediate response, the meaning of the situation and the
appropriate responses must be extremely clear and simple, or mistakes will be made. In contrast to
strategic dashboards, operational dashboards must have the means to grab your attention immediately if
an operation falls outside the acceptable threshold of performance. Also, the information that appears on
operational dashboards is often more specific, providing a deeper level of detail. If a critical shipment is at
risk of missing its deadline, a high‐level statistic won’t do; you need to know the order number, who’s
handling it, and where it is in the warehouse. Details like these might appear automatically on an
operational dashboard, or they might be accessed by drilling down on or hovering the mouse over higher‐
level data, so interactivity is often useful.
The ways that dashboard design must take different forms in response to different roles are clearly worth
your attention. We’ll examine some of these differences in more detail in Chapter 8, Putting It All Together,
when we review several examples of what works and what doesn’t for various purposes.
https://public.tableau.com/profile/ravi2917#!/vizhome/LorealDemo/StrategicDashboard

 
 Tableau Expert Megan Putney
 Megan Putney, head of Northwest Arkansas Tableau Users Group and an executive at Mikes Hard Lemonade
https://www.linkedin.com/in/megan-putney-21432839/ 

https://community.tableau.com/groups/northwest-arkansas


Good to hear from you!  It was a busy week for me too - Walmart mod season, EMBA project work, EMBA finals, and the Tableau meeting!   
Luckily Tableau has been recording and posting all of our meetings to Youtube.  You didn’t miss much last week.  I ended up presenting some materials from a couple of years ago since I had presenters bail at the last minute.  
 
Last week’s meeting is here.  
September meeting is here  

That is so cool that your class is running the COVID site!  I’ve seen a few people posting a similar snapshot to what you have there on the first page.  
And yes, I’d love to catch up.  Let me know, and we can schedule a virtual coffee & chat!  
Megan


Module #7: WordPress

Using WordPress
--Author powers 
--To access back end of datareporting: 
https://wordpressua.uark.edu/datareporting/wp-admin
Login with UARK credentials.
Quick tips on Gutenberg editor
https://wordpressua.uark.edu/datareporting/wordpress/

Blocks
Verse
Paragraph
Image
Custom HTML
Code


Embed Flourish in WordPress
Under Published in Flourish, find embed code.
Create a post. 
Create a block - custom html.
Paste code there. Save and update
Looks like this:
Embed Tableau in WordPress


Using Tableau Public to Host Graphics
--Create Tableau Public account if you haven't already
--Load your student loan graphic to Tableau Public.

–Post on WordPress.
Create a new post
Use Divi Builder, the Purple box above the formatting bar
Insert columns, pick a full row
Insert module, pick </> Code
Paste your Tableau Public embed code in the Content box
Scroll down, change the Admin Label to My Mind-Blowing Tableau Graphic (or something more humble). Save and Exit
Change Page Layout (upper right corner) to Fullwidth. Publish
Revel in your nerd powers

Building the Web Page
Gutenberg has blocks to display text, graphics, video etc.
Everyone has to build their own page in DataReporting site of WordPress.
Tasks:
Create a Post.
Upload your graphic from Assignment #1 and your story.
Format so it doesn’t look ugly
Click “Student Work” for category.