The Mad Hatter’s Guide to Data Viz and Stats in R
  1. Data Viz and Stats
  2. Case Studies
  3. California Transit Payments
  • Data Viz and Stats
    • Tools
      • Introduction to R and RStudio
    • Studio Flow and Data Kits
      • 12-Day Studio Index
      • Healthcare Data Kits
    • Visualization
      • Data
      • Inspect Data
      • Graphs
      • Summaries
      • Counts
      • Quantities
      • Groups
      • Distributions
      • Groups and Distributions
      • Change
      • Proportions
      • Hierarchy
      • Evolution and Flow
      • Ratings and Rankings
      • Surveys
      • Time
      • Space
        • Introduction to Maps
        • What is Vector Data?
        • The Grammar of Maps
        • Interactive Maps with leaflet
      • Networks
      • Miscellaneous Graphing Tools, and References
    • Inference
      • Basics
      • 🎲 Samples
      • Randomization
      • One Mean
      • Two Independent Means
      • Two Paired Means
      • Multiple Means (ANOVA)
      • Correlation
      • One Proportion
      • Two Proportions
    • Modelling
      • Linear Regression
      • Logistic Regression
      • 🕔 Time Series
    • Workflow
      • Facing the Abyss
      • I Publish, therefore I Am
      • Data Carpentry
    • Arts
      • Colours
      • Fonts for Charts
      • Font Effects in Charts
      • Branding and Typography
      • Annotations
      • More Annotations
      • Highlighting
      • Scales
    • AI Tools
      • Using gander and ellmer
      • Using Github Copilot and other AI tools to generate R code
      • Using LLMs to Explain Stat models
    • Case Studies
      • Demo:Product Packaging and Elderly People
      • Ikea Furniture
      • Movie Profits
      • Gender at the Work Place
      • Heptathlon
      • School Scores
      • Children's Games
      • Valentine’s Day Spending
      • Women Live Longer?
      • Hearing Loss in Children
      • California Transit Payments
      • Seaweed Nutrients
      • Coffee Flavours
      • Legionnaire’s Disease in the USA
      • Antarctic Sea ice
      • William Farr's Observations on Cholera in London
    • Projects
      • No Free Hunch

On this page

  • 1 Setting up R Packages
    • 1.1 Plot Fonts and Theme
  • 2 Introduction
  • 3 Read the Data
  • 4 Data Dictionary
  • 5 Data Munging
  • 6 Summarize and Prepare the Data
  • 7 Plot the Data
  • 8 Task and Discussion
  1. Data Viz and Stats
  2. Case Studies
  3. California Transit Payments

California Transit Payments

1 Setting up R Packages

library(tidyverse)
library(mosaic)
library(skimr)
library(ggformula)
library(correlation)
#
library(ggstats)
library(labelled)

1.1 Plot Fonts and Theme

Use _setup.qmd to set these up.

2 Introduction

This dataset is the result of a research study on payment options for people using public transit in California.
The dataset is available on Dataset Dryad:

Pike, Susan (2022). Transit payment preferences of unbanked passengers. Dataset Dryad. https://doi.org/10.25338/B8R04T

And a brief 2-pager on the research methodology is here.

Yes, peasants, you should read such stuff from other very different domains!

3 Read the Data

4 Data Dictionary

NoteQuantitative Variables

Write in.

NoteQualitative Variables

Write in.

NoteObservations

Write in.

5 Data Munging

Munged Data

6 Summarize and Prepare the Data

Let’s label the data variables…

Data summary
Name CalPayment2
Number of rows 204
Number of columns 5
_______________________
Column type frequency:
numeric 5
________________________
Group variables None

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
phone.wifi 0 1 1.45 0.50 1 1 1 2 2 ▇▁▁▁▆
phone.money 0 1 1.32 0.47 1 1 1 2 2 ▇▁▁▁▃
phone.identity 0 1 1.32 0.47 1 1 1 2 2 ▇▁▁▁▃
phone.fees 0 1 1.29 0.45 1 1 1 2 2 ▇▁▁▁▃
phone.balance 0 1 1.29 0.46 1 1 1 2 2 ▇▁▁▁▃

Labelled Data

7 Plot the Data

8 Task and Discussion

Complete the Data Dictionary. Select and Transform the variables as shown. Create the graph shown below and discuss the following questions:

  • Identify the type of charts
  • Identify the variables used for various geometrical aspects (x, y, fill…). Name the variables appropriately.
  • What activity might have been carried out to obtain the data graphed here? Provide some details.
  • What would be your recommendation to the Transport Company?
  • To the Phone Companies?
Back to top
Hearing Loss in Children
Seaweed Nutrients

License: CC BY-SA 2.0

Website made with ❤️ and Quarto, by Arvind V.

Hosted by Netlify .