#### Category: Workshops

iNZight into Baseball Nov. 10th, 1:00-2:00pm, TLC
Joshua Korenblat
Assistant Professor of Graphic Design

Want to celebrate the World Series? Interested in learning how to make graphs and charts?

Come learn how to use iNZight lite and Google Sheets to analyze baseball statistics, including batting and pitching data, from 1871-2015.

### What we’ll learn today

• Today we’ll  learn how to survey, sift, summarize, sort, filter,  and visualize your data.
•  We’ll learn what things to look out for during the visual analysis process of histograms, boxplots and scatterplots/ bubbleplots: two visualization types that rely upon position in space to help us compare distributions and variables with greater nuance and clarity.
• We’ll learn how to leverage the power of free tools: Google Sheets and iNZight.
• We’ll learn how to export your visualizations into art and design applications, such as Adobe Illustrator, for further crafting, creating a delightfully informative read.

### Why Baseball?

Recently, I ran across a news article listing the world’s largest recorded human gatherings.

A pilgrimage in Northern India summoned ~30 million people, and Mecca is always a destination.

Looking around, I noticed a few surprise entries, notably a Rod Stewart Concert in Rio (~4 million people)
and the 2016 World Series Celebration for the Chicago Cubs.

Here are the breakdowns. Each person = 1 million people.

Why was the Chicago Cubs World Series such a big deal? Well, this was the last Cubs World Series Championship team:

The Cubs hadn’t won a World Series in 108 years. To quote some stage direction from Shakespeare, “Exit, pursued by bear…”

Baseball thrives on statistics. 108 years parallels the 108 stitches in a baseball. There’s a poem in that idea.

Although we’re using baseball data here, this simply serves as an analogy for your data: any collection of information with many observations, and many variables (categories) within those observations.

Let’s take a look at data from baseball history, find out more about that 1908 season, and create some visualizations using Google Sheets and iNZight, a free package developed at the University of Auckland that runs through R, the world’s most popular open source stats application. No worries: no coding required!

### Resources for this workshop

iNZight

iNZight Lite

Lanham Baseball Database

Baseball Reference

Retrosheet

To follow along with the data, use Google Chrome for your browser. Go here and make sure to log into Google Sheets —>
iNZight into Baseball

Go to File —> Make A Copy to bring this into your own Google Drive.

TeamsFranchises: First, let’s explore the first worksheet. Check out the Explore button in the lower right corner. We can find a lot of information about our data simply by clicking in a cell on a worksheet.

To get more specific data, let’s write a COUNTIF formula in some empty cells.

Teams: Let’s make a Pivot Table. Click on the corner between A & 1. Then go to Data —> Pivot Table

For Rows,  select name. For values, select  W and L. Filter the year to 1908.

Now, select the data frame this creates. Copy. Create a new worksheet. Go to Paste —> Paste Special —> Paste Values Only.

Let’s make a chart from this data. Highlight the data you want to chart. Then go to Insert Chart.

Now, here’s a trick to download your chart for further customization in Adobe Illustrator or Inkscape.

Make sure you are using Google Chrome for your browser. Go here: http://nytimes.github.io/svg-crowbar/

Once SVG Crowbar is installed. You can download your chart to your favorite art and design application.

baseball-teams

Feel free to experiment with the other 1908 tabs. See if you can explore them and create meaningful charts.

Hall of Fame Batters

Go to File —> Make a Copy

Download the worksheet as a CSV file.

Go to Inzight Litehttp://lite.docker.stat.auckland.ac.nz/

Go to File —> Import Dataset

*Histogram: See distribution of a single variable: Count of players per era.
*Compare distributions of Home Runs per Era: this changes to a dotplot, with a boxplot underneath

*Code more variables (colors and style)
*Advanced —> Explore: Let iNZight give you a tour!

What can’t iNZight Lite do? It’s just not quite as robust as running it as package through R. I use R Studio, an  IDE for the R language.

Follow the installation instructions.

Next, open up R Studio. Create a new script. Copy-and-paste this text into the script editor:

install.packages(c(“vit”, “iNZightMR”, “iNZightTS”, “iNZightModules”, “iNZightRegression”, “iNZightPlots”, “iNZight”, “iNZightTools”),
repos = c(“http://r.docker.stat.auckland.ac.nz/R”,
“http://cran.stat.auckland.ac.nz”))    # or your preferred CRAN Mirror
library(vit)
iNZightVIT()

Today we learned how to survey, sift, summarize, sort, filter,  and visualize your data.

We learned what things to look out for during the visual analysis process of boxplots and scatterplots/ bubbleplots.

We learned how to leverage the power of free tools: Google Sheets and iNZight.

We learned how to export your visualizations into art and design applications, such as Adobe Illustrator, for further crafting, creating a delightfully informative read.

Thank you!

Questions?

Manage Your Citations: Presentation

Taking too long?

| Open in new tab

Citations Comparison Chart Handout

Taking too long?

| Open in new tab

Google and the Mobile Researcher
by Lydia Willoughby
Paperpile
MetaPDF

Zotero
Zotero
Zotero Quick Start Guide

Mendeley
by Heather Shimon
Mendeley
Mendeley Guides & Tutorials

## Set up for Google Maps:

2. Navigate to http://maps.google.com
3. Click on the icon with three horizontal bars in the left-hand side of the search bar.
4. Click on “My Maps.”
5. Click on “Create Map” and give your map a title and a description by clicking on the words “Untitled Map” in the upper-left hand side of the screen and completing the empty fields.
6. To add locations to your map, type a location in the search box, (e.g. 221B Baker Street, London), click on the resulting point, and then click “Add to Map”

### Editing Google Maps Data

1. First, let’s add text
1. Click on the location, then click on the icon of a pencil
2. Type a title and description for the location
3. Click “Save”
2. Next, let’s add an image to a location
1. Click on the icon of a camera.
2. Do a Google image search for your location, choose a picture of the area, click on the image you want, and click “Select”
3. Click “Save” to save your picture.
3. Next, let’s color-coordinate the locations
1. Each location is listed in the box on the left; hover over your location in the box on the left and click on the icon of a paint-bucket that appears on the right.
2. Select a color and shape from the drop down menu to determine the appearance of the location pins.
4. Finally, let’s add lines to connect the locations
1. Figure out the order you’d like the locations to have
2. Click the icon that looks like several dots connected with lines and select “Add line or Shape” (or “Add Walking Route” if the characters walk between the points).
3. Click on each location in order and hit enter when you’re done.
4. Give the line a name and a description.
5. To change the line’s appearance or color, hover over the name of the line in the left-hand box alongside the locations and click the paint-bucket icon that appears.
6. Select the desired color and line width.
5. Let’s share the map
1. In the upper-left part of the screen, click the word “Share”
2. To let others see your map, click on the word “Change” in blue
3. Select “Anyone with link” to let anyone with the map link see your map
6. To let other people collaborate on your map, type their email addresses into the box labeled “Invite people”

## Using Mapbox:

Mapbox (https://www.mapbox.com/editor) is another great mapping program that lets you customize things a little more and makes more elegant maps. However, it doesn’t let multiple people edit the same map simultaneously, so collaboration is harder.

### Importing Data:

1. Make a Mapbox account (https://www.mapbox.com/editor) and log in.
2. Click the button labeled “New Mapbox Editor Project.”
3. Click “Style,” then click on the map style you want from the resulting list.
4. Click on “Project,” -> “Settings” and give your project a title and a description.
5. Click the “Save” button.

### Adding and Editing Data:

1. Click on the icon of a magnifying glass, type in your address, and hit enter.
2. Click on the point that appears on the map to add it to your map.
3. A window will pop up on the left. Add the title and description in the text fields
4. Click the word “Style”at the bottom of the new window to select the color and size of the location icon.
5. Click the word “Symbol” next to the word “Style” to add your favorite icon symbol to the location.
6. To find an image for a location:
1. Do a Google image search (https://images.google.com/) for your location to find the perfect image.
2. Once you’ve found it, Click it, then click “View image” in the next window, and copy the new URL to get the image URL (NOTE: it should end with .jpg, .png, or .tif).
7. Go back to your Mapbox project, and click “Text” again.
1. Click at the end of your description in the “Add a description” field
2. Type <img src=”URL”> (replacing URL with the URL you copied in step 6.2)
3. For example, if I wanted this picture of Baker Street associated with Baker street, I would type <img src= “https://shipscooksstuff.files.wordpress.com/2012/02/baker3.jpg“>
4. Click the “Save” button.
8. Remember the order for your locations, and get ready to draw lines.
1. Click the “Line” button, then click on the correct points in order.
2. Double-click on the final location.
3. Give the line a name (e.g. “Order of events in “A Scandal in Bohemia”) and a color.
4. Click the “Save” button.
9. To see what your map looks like, click “Project” -> “Info,” and copy and paste the URL listed under “Share” into a browser.

## Sample Student Maps:

The Picture of Dorian Gray Map: http://tinyurl.com/doriangraymap

The Romance of a Shop Map: http://tinyurl.com/romanceofashop

Nirvana Map: Obscurity to Domination: http://nirvanatour.tumblr.com/

Map of Holmes story “The Twisted Lip”: http://tinyurl.com/twistedlipmap

Map of Holmes story “A Scandal in Bohemia”: http://tinyurl.com/scandalbohemiamap

## Set up for Google Maps:

2. Navigate to http://maps.google.com
3. Click on the icon with three horizontal bars in the left-hand side of the search bar.
4. Click on “My Maps.”
5. Click on “Create Map” and give your map a title and a description by clicking on the words “Untitled Map” in the upper-left hand side of the screen and completing the empty fields.
6. To add locations to your map, type a location in the search box, (e.g. 221B Baker Street, London), click on the resulting point, and then click “Add to Map”

### Editing Google Maps Data

1. First, let’s add text
1. Click on the location, then click on the icon of a pencil
2. Type a title and description for the location
3. Click “Save”
2. Next, let’s add an image to a location
1. Click on the icon of a camera.
2. Do a Google image search for your location, choose a picture of the area, click on the image you want, and click “Select”
3. Click “Save” to save your picture.
3. Next, let’s color-coordinate the locations
1. Each location is listed in the box on the left; hover over your location in the box on the left and click on the icon of a paint-bucket that appears on the right.
2. Select a color and shape from the drop down menu to determine the appearance of the location pins.
4. Finally, let’s add lines to connect the locations
1. Figure out the order you’d like the locations to have
2. Click the icon that looks like several dots connected with lines and select “Add line or Shape” (or “Add Walking Route” if the characters walk between the points).
3. Click on each location in order and hit enter when you’re done.
4. Give the line a name and a description.
5. To change the line’s appearance or color, hover over the name of the line in the left-hand box alongside the locations and click the paint-bucket icon that appears.
6. Select the desired color and line width.
5. Let’s share the map
1. In the upper-left part of the screen, click the word “Share”
2. To let others see your map, click on the word “Change” in blue
3. Select “Anyone with link” to let anyone with the map link see your map
6. To let other people collaborate on your map, type their email addresses into the box labeled “Invite people”

## Using Mapbox:

Mapbox (https://www.mapbox.com/editor) is another great mapping program that lets you customize things a little more and makes more elegant maps. However, it doesn’t let multiple people edit the same map simultaneously, so collaboration is harder.

### Importing Data:

1. Make a Mapbox account (https://www.mapbox.com/editor) and log in.
2. Click the button labeled “New Mapbox Editor Project.”
3. Click “Style,” then click on the map style you want from the resulting list.
4. Click on “Project,” -> “Settings” and give your project a title and a description.
5. Click the “Save” button.

### Adding and Editing Data:

1. Click on the icon of a magnifying glass, type in your address, and hit enter.
2. Click on the point that appears on the map to add it to your map.
3. A window will pop up on the left. Add the title and description in the text fields
4. Click the word “Style”at the bottom of the new window to select the color and size of the location icon.
5. Click the word “Symbol” next to the word “Style” to add your favorite icon symbol to the location.
6. To find an image for a location:
1. Do a Google image search (image.google.com) for your location to find the perfect image.
2. Once you’ve found it, Click it, then click “View image” in the next window, and copy the new URL to get the image URL (NOTE: it should end with .jpg, .png, or .tif).
7. Go back to your Mapbox project, and click “Text” again.
1. Click at the end of your description in the “Add a description” field
2. Type <img src=”URL”> (replacing URL with the URL you copied in step 6.2)
3. For example, if I wanted this picture of Baker Street associated with Baker street, I would type <img src= “https://shipscooksstuff.files.wordpress.com/2012/02/baker3.jpg“>
4. Click the “Save” button.
8. Remember the order for your locations, and get ready to draw lines.
1. Click the “Line” button, then click on the correct points in order.
2. Double-click on the final location.
3. Give the line a name (e.g. “Order of events in “A Scandal in Bohemia”) and a color.
4. Click the “Save” button.
9. To see what your map looks like, click “Project” -> “Info,” and copy and paste the URL listed under “Share” into a browser.

## Sample Student Maps:

The Picture of Dorian Gray Map: http://tinyurl.com/doriangraymap

The Romance of a Shop Map: http://tinyurl.com/romanceofashop

Nirvana Map: Obscurity to Domination: http://nirvanatour.tumblr.com/

Map of Holmes story “The Twisted Lip”: http://tinyurl.com/twistedlipmap

Map of Holmes story “A Scandal in Bohemia”: http://tinyurl.com/scandalbohemiamap