Skip to content

R for Journalists

Unlock the power of R

  • What Is R?
  • R for Rob
  • GitHub
  • Twitter
  • Etsy
  • Home
  • 2016
  • September
  • 30
  • How Poor Children Are More Likely To Be Fat

How Poor Children Are More Likely To Be Fat

Posted on September 30, 2016October 1, 2016 By Rob
See

ncmp_v5

Poorer children are more likely to be fat.

As we move further to the right of the chart into schools in more deprived areas, the share of children in the grey and black parts of the chart – showing overweight and very overweight kids – gets bigger.

This means that a class of year six children in inner-city Manchester will likely have bigger waistlines than one in leafy Hampshire.

A combination of bad diets and a lack of exercise means poorer children are sadly more likely to be fat at just 10 or 11 years old, with all the health problems that brings now and stores up for the future.

About the data

The data comes from the National Child Measurement Programme (NCMP), which takes the height and weight of children in reception and year six classes each year.

If you have someone’s height and weight you can measure their Body Mass Index (BMI). This is a good way of measuring overall body shape and therefore obesity.

NHS Digital have published the entire dataset for the past two years. The latest file for 2014/15 contains the anonymised records of more than one million children.

(NB: I tried this link this morning and it wasn’t working. NHS Digital is changing its website so hopefully this should be fixed soon).

R is powerful enough to handle all this data, and it’s what I used to make this chart.

Deprivation

The chart only works because the data contains part of the Index of Multiple Deprivation.

Each record contains the deprivation score for a child’s school on a 10-point scale, where one is the most deprived and 10 the least.

We’re assuming that if a school is in a deprived area, most of the pupils there will be as well.

Using R and ggplot2 to make the histogram

Like before, I created this in RStudio with the ggplot2 and scales packages loaded.

The first thing to do is to select which year group to analyse. I chose year six.

# filter the data to get year six
year.six <- grep("6", ncmp$schoolyear)
year.six.data <- ncmp[year.six, ]

The ‘grep’ function here is a regular expression. Explaining what regular expressions (regex) is a post in itself, so I won’t do that here.

The NHS groups children’s BMI scores into four categories: ‘underweight’, ‘healthy weight’, ‘overweight’ and ‘very overweight’. We need to tell R that these aren’t just random, they go in order. We do that using a factor, like this:

# factor the BMI scores
year.six.data$bmiclinicalcategory <- factor(year.six.data$bmiclinicalcategory, 
levels = c("underweight",
"healthy weight",
 "overweight",
"very overweight",
 ordered=TRUE))

Next up, we’ll choose some colours for our chart rather than letting R choose them for us. There are some useful palettes here – I chose one that had the relatively small underweight section in a bold colour so you can see it.

# make a colour palette
BMI_fill <- scale_fill_brewer("BMI Category", palette = "RdGy")

Plotting the chart:

# draw the plot with the school deprivation index on the x axis
ggplot(year.six.data, aes (x = schoolindexofmultipledepriv, 
 fill= factor(bmiclinicalcategory))) 

# draw the histogram, making the y axis into percentages

+ geom_histogram(binwidth = 1, 
 aes(y = ..count../sum(..count..)), 
 position = "fill")

# reverse the scale so that one (most deprived) appears on the right (this requires the scales package)

+ scale_x_reverse(breaks=NULL)

At this point your chart should look something like this:

ncmp_halfway

Everything from here on out is just decoration:

# add a white background and our colour palette

+BMI_fill + theme_classic()

# label axes and title, including giving % icons

 + labs(y = "% in each weight class", 
 x = "Schools in more deprived areas ->", size = 4) 
+ ggtitle("How Poor Children Are More Likely To Be Fat") 
+ scale_y_continuous(labels = scales::percent)
+theme(axis.title = element_text(size=34),
 axis.text = element_text(size = 18),
 plot.title = element_text(size = 44),
 legend.title = element_text(size = 28),
 legend.text = element_text(size = 20))

There you have it…

…a clear link between deprivation and child obesity, in one chart.

ncmp_v5

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related

Tags: child obesity dataviz deprivation histogram journalism NCMP rstats

Post navigation

❮ Previous Post: Creating a Premier League Results Matrix in R
Next Post: Make Your Labels Legible on Mobile ❯

Recent Posts

  • I’ve moved my blog over to Substack
  • How to plot a large rural area using Ordnance Survey data in R
  • Check the COVID-19 vaccination progress in your area
  • Let R tell you what to watch on Netflix
  • Sentiment analysis of Nineteen-Eighty-Four: how gloomy is George Orwell’s dystopian novel?

Archives

  • April 2022
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • February 2020
  • December 2019
  • November 2019
  • October 2019
  • April 2018
  • March 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016

Categories

  • Geospatial data
  • Landmark Atlas
  • Learn
  • See
  • Seen Elsewhere
  • Site
  • Uncategorized

Copyright © 2025 R for Journalists.

Theme: Oceanly by ScriptsTown

 

Loading Comments...