Are there really more sheep than human in New Zealand?

Kan Nishida
learn data science
Published in
6 min readJan 11, 2017

--

Whenever we happen to talk about New Zealand, someone in the room has to say

“There are more sheep than people!”

It’s almost a cliche, but no cliche comes out from nothing. (maybe this could be completely my personal experience!) So I searched the web to see if that was true, and luckily I’ve found this livestock population data from New Zealand government website called Statistics New Zealand.

I also found data about the population of human in the country and about the administrative boundaries from the same website. This means, I can not only compare the populations of sheep and human, but also can visualize the data geographically with Map. Here are the links for downloading those data.

  • Human Population Data (Link)
  • Livestock (including Sheep) Data (Link)
  • Geographic Boundaries Data (Link)

If you are interested in how to create GeoJSON files for some of the New Zealand’s administrative boundaries, take a look at this post.

Ok, let’s start.

Livestock animals population by Region

First, let’s look at the historical sheep and other livestocks population trend in New Zealand.

As we can see, there are almost 29 million sheep in New Zealand in 2015, though the number is decreasing over the last decade. Looks the industry is shriking…

Anyway, these population data are also available at Region level, which is similar to States in United States or Provinces / Prefectures in other countries. So I have visualized the data on Map like below to show the sheep population of 2015 by the regions.

We can see that the south side of the southern island has more sheep population than the other areas.

We can compare this to the population of ‘Dairy Cattle’.

And this is for Beef cattles.

So, it’s not like the southern island is more livestock farm lands than the northern island in general. But when it comes to sheep, there are more sheep in south. 🐑🐑🐑

More Sheep or Human?

Now, let’s find out if there are really more sheep than human. To do this, we can join two data frames, one for sheep and another for human.

UI

R command

left_join(Population, by = c("Area" = "Area"))

And we can simply compare the total values between the two by using Bar chart. The blue color is for the number of sheeps and the orange is for human. So the short answer is, YES! More sheep than human in the country.

Note that the population data is available only up to 2013, so I compared them based on the populations of both sheep and human in 2013 as below.

filter(year(Year) == 2013)

There are about 30 million sheep compared to about 4.4 million people in New Zealand. Ok, this is easy.

But does this mean that we will see sheep literally everywhere we go in New Zealand? To answer this question, we can quickly calculate the ratio of the population of sheep vs. human like below.

mutate(sheep_human_ratio = number_of_animals / number_of_human)

Also, we can create a set of ‘buckets’ for the range of the ratio by using ‘cut’ function like below so that we can visualize the data more effectively by assigning this to Color.

mutate(buckets = cut(sheep_human_ratio, breaks=c(-Inf, 1, 10, 20, 30, 40, Inf), 
labels=c("Less than Human", "1-10 Times More",
"10-20 Times More", "20-30 Times More", "30-40 Times More",
"Greater than 40 Times")))

And here is how it looks on Map at New Zealand Region level.

The darker the red-brown color, the higher ratio of sheep compared to human.

Wow, Southland Region, which is highlighted in the Map above, has 42 times more sheep than human! That’s A LOT! That’s basically like this in the region.

🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🚶🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑🐑

Basically, for most of the areas there are more sheep than human. This bar chart below might give you a better sense of how much more sheep (or more human) for each region.

Here is the ratio numbers. Any number less than 1 means there are more human than sheep.

So, to conclude, there are indeed more sheep than human in most of the regions in New Zealand, except a few regions like Auckland, West Coast, and Nelson. So the next time you hear somebody goes ‘there are more sheep than human in New Zealand!’, you know what to say.

Cheers to New Zealand Sheep!

How to Reproduce?

I have shared the data with the data wrangling steps in a reproducible way here. You can download EDF (Exploratory Data Format) and import it into your Exploratory Desktop to reproduce it from the beginning to the end or extend further.

Also, here’s an reproducible R Script.

# Set libPaths.
.libPaths("/Users/kannishida/.exploratory/R/3.3")

# Load required packages.
library(lubridate)
library(stringr)
library(readr)
library(dplyr)
library(exploratory)
# Human population data
Population <- exploratory::read_delim_file("/Users/kannishida/Downloads/Estimated_resident_population.csv" , ",", quote = "\"", skip = 0 , col_names = TRUE , na = c("","NA") , locale=locale(encoding = "ASCII", decimal_mark = "."), trim_ws = FALSE , progress = FALSE) %>%
exploratory::clean_data_frame() %>%
filter(!str_detect(Area, "^Total") & str_detect(`Ethnic group`, "^Total") & `Year at 30 June` == 2013) %>%
select(-Age, -Sex, -Flags, -`Ethnic group`) %>%
mutate(Area = str_replace(Area, "region", "Region"))
# Data Analysis Steps
exploratory::read_delim_file("/Users/kannishida/Downloads/Livestock_by_Regional.csv" , ",", quote = "\"", skip = 0 , col_names = TRUE , na = c("","NA") , locale=locale(encoding = "ASCII", decimal_mark = "."), trim_ws = FALSE , progress = FALSE) %>%
exploratory::clean_data_frame() %>%
filter(!str_detect(Area, "^Total")) %>%
filter(str_detect(Livestock, "^Total")) %>%
mutate(Year = mdy(Year), Area = str_c(Area, " Region"), Area = str_replace(Area, "Hawkes", "Hawke's")) %>%
filter(year(Year) == 2013 & !is.na(Value)) %>%
filter(Livestock == "Total sheep") %>%
left_join(Population, by = c("Area" = "Area")) %>%
filter(!is.na(Value.y)) %>%
rename(number_of_animals = Value.x, number_of_human = Value.y) %>%
mutate(sheep_human_ratio = number_of_animals / number_of_human, buckets = cut(sheep_human_ratio, breaks=c(-Inf, 1, 10, 20, 30, 40, Inf),
labels=c("Less than Human", "1-10 Times More",
"10-20 Times More", "20-30 Times More", "30-40 Times More",
"Greater than 40 Times")))

--

--

CEO / Founder at Exploratory(https://exploratory.io/). Having fun analyzing interesting data and learning something new everyday.