Exploring Montgomery County's Adoptable Pets
Meet Zero! A 7 year old pit mix who was among those availble at the time of the data pull

Exploring Montgomery County's Adoptable Pets

2025, Mar 10    

For this exercise, I decided to mix my passions: dogs and data! I went to data.gov and saw that Montgomery County, Maryland had data on their currently available adoptable pets. It was a match made in heaven.

Pulling data into R from the API & preparing for analysis

In order to pull data from the data.gov API you have to first request an API Key. Once I had a key, I stored it securely in my code using keyring. I was then able to make a query, and extract the content of that query. The data were in a nested list format, which if you’ve not encountered before can take some getting used to. I was able to leverage the purr package to get the data in a tidy format. I added some API and nested list resources that I found helpful to the wiki of my repo, lovingly named “playground.”

  • Raw input data: The data were sourced from Montgomery County MD via data.gov here.
  • Processed output data: The tidy data output was stored here.
  • My code: My code for this project is here

Key questions & their answers visualized

1. What kinds of animals are available for adoption?

Somewhat unsurprisingly, most of the available pets were dogs. But there were a few birds and other animals available too.

Adoptable animals

Normally, I would sort a bar chart by something meaningful like the volume, but as humans I think we are accustomed to seeing the days of the week in the order that they occur so I made the choice to order them chronologically. My initial assumption was that weekends would be the most popular but Tuesday was actually the most common intake day (for those animals that were at the shelter at the time of the data pull), with volume high Fri, Sat, Mon and Tues. Wednesday turned out to be the least popular day for surrender or intake.

Intake Days

3. Which dog breeds are a surrendered by their owners most?

I was then curious which dog breeds made up the highest proportion of those available. This was a fun opportunity to do a waffle chart! And, I found that just over 70% of the available dogs were pit bulls or pit bull mixes.

Dog Breeds

4. How old are the available dogs?

Next, my thought was about how old the dogs were. Are they older dogs or were pets being surrendered or found as younger animals? Approaching this question took some data cleaning because the dataset provided was MESSY. The column for pet age had both numeric and text values AND had multiple units both months and years. Yikes.

To address this, I extracted the values before the word months and the values before the word years and made columns for these respectively. I then made a total months column along with a total years column that converted total months to years.

Once I had the total years column created, I was able to assess the age of each dog. The average age of the dogs was about 3 years old, but there were some outliers, especially among the pit/pit mixes with a dog as old as 12.

Dog Ages