Skip to content
R for the Rest of Us Logo

Ally Livestream Free

Using AI to create data visualizations in R

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

I spent this livestream building data visualizations for a California version of my 'by the numbers' county report, using Claude as an AI agent to write and revise the R code while I directed it through voice dictation and iterative feedback.

You'll learn:

  • How to use an AI agent to generate and revise ggplot maps and charts by giving it reference images and iterative verbal instructions
  • How to ask AI for visualization ideas before committing to one, then evaluate the options based on your audience
  • A way to verify that AI-generated code is actually doing what you expect by reading through it and questioning specific calculations, like how state-level summary statistics are computed
  • How to prompt AI to clean up its own code after the fact by asking it to review for duplication and centralize repeated values like color palettes
  • How to use sub-agents to work on two tasks in parallel within a single AI session

Tools mentioned: Claude, Positron, Soulo, ggplot2, tigris, tidycensus, marquee, GT, renv, GitHub Copilot, GitHub Desktop, Raycast, Whisper Flow

Key moments:

  • 00:56 Introduction to the Oregon by the Numbers project and today's goal
  • 04:34 Overview of using Claude via the Soulo tool as an AI agent
  • 06:13 Voice dictation prompt to create a state map for California
  • 10:21 Map renders successfully using ggplot
  • 11:05 Prompting Claude to build a county-level map highlighting Los Angeles County
  • 23:11 Moving to median household income visualization
  • 24:21 Asking Claude for chart ideas before deciding on an approach
  • 32:10 Chart renders and David questions how state median is calculated
  • 40:07 Adding highlighted text to the chart title using the marquee package
  • 48:46 Using sub-agents to work on race ethnicity chart and population table simultaneously
  • 01:00:00 Population table renders with GT
  • 01:08:05 Asking Claude to review the full script for duplication and suggest improvements
  • 01:14:05 Claude runs all plots to verify nothing broke after refactoring