Isle of Wight Employment Stats

This is an example of pulling down jobless figures from nomisweb for the Isle of Wight.

Provided as a demonstrator for OnTheWight by Tony Hirst, (Computing and Communications Department, The Open University, and the Open Knowledge Foundation).

The most recent figures:

Date Isle of Wight South East(%) Great Britain(%)
Oct 2013 2781 1.90 3.00

The previous figures:

Date Isle of Wight South East(%) Great Britain(%)
Sep 2013 2687 2.00 3.20

Last three months' figures:

Date Isle of Wight South East(%) Great Britain(%)
Aug 2013 2720 2.10 3.30
Sep 2013 2687 2.00 3.20
Oct 2013 2781 1.90 3.00

Previous year's figures:

Date Isle of Wight South East(%) Great Britain(%)
Aug 2012 2959 2.50 3.80
Sep 2012 2994 2.40 3.70
Oct 2012 3158 2.40 3.70
Nov 2012 3478 2.40 3.70

A little bit of machine generated explanatory text:

The total number of people claiming Job Seeker's Allowance (JSA) on the Isle of Wight in October was 2781, up 94 from 2687 in September, 2013, and down 377 from 3158 in October, 2012.

plot of chunk unnamed-chunk-9

plot of chunk unnamed-chunk-10

If we plot the monthly change we get a better idea for how monthly changes compare with previous years:

plot of chunk unnamed-chunk-11

plot of chunk unnamed-chunk-12

plot of chunk unnamed-chunk-13

require(reshape)
## Loading required package: reshape
## Loading required package: plyr
## 
## Attaching package: 'reshape'
## 
## The following object is masked from 'package:plyr':
## 
##     rename, round_any

nomis <- read.csv("http://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.data.csv?geography=1946157281&date=latestMINUS1,latest&select=date_name,geography_name,geography_code,sex_name,item_name,measures_name,obs_value,obs_status_name&measures=20100,20203")


nomis <- read.csv("http://www.nomisweb.co.uk/api/v01/dataset/NM_4_1.data.csv?geography=1946157281&date=latestMINUS1,latest&measures=20100&select=DATE,DATE_NAME,GEOGRAPHY_NAME,AGE_DUR_NAME,SEX_NAME,MEASURES,MEASURES_NAME,OBS_VALUE")
nx = nomis[grep("Claiming", nomis$AGE_DUR_NAME), ]
nx[nx$SEX_NAME == "Total,"]
## data frame with 0 columns and 96 rows

nx$AGE_DUR_NAME <- factor(nx$AGE_DUR_NAME, levels = c("Claiming one week or less", 
    "Claiming over 1 and up to 2 weeks", "Claiming over 2 and up to 4 weeks", 
    "Claiming over 4 and up to 6 weeks", "Claiming over 6 and up to 8 weeks", 
    "Claiming over 8 and up to 13 weeks", "Claiming over 13 and up to 26 weeks", 
    "Claiming over 26 and up to 39 weeks", "Claiming over 39 and up to 52 weeks", 
    "Claiming over 52 and up to 65 weeks", "Claiming over 65 and up to 78 weeks", 
    "Claiming over 78 and up to 104 weeks", "Claiming over 104 and up to 156 weeks", 
    "Claiming over 156 and up to 208 weeks", "Claiming over 208 and up to 260 weeks", 
    "Claiming over 260 weeks"))

nxxx = cast(nx[, c("DATE", "AGE_DUR_NAME", "OBS_VALUE")], AGE_DUR_NAME ~ DATE)
## Using OBS_VALUE as value column.  Use the value argument to cast to override this choice
## Aggregation requires fun.aggregate: length used as default

require(stringr)
## Loading required package: stringr
nnx = nomis[grep("claiming", nomis$AGE_DUR_NAME), ]
levels(nnx) = droplevels(nnx)
nnx$ad = str_replace(nnx$AGE_DUR_NAME, "Aged (.*) claiming.*", "\\1")
nnx$ad = factor(nnx$ad)
nnx$ad = factor(nnx$ad, levels = c("under 17", "17", "18", "19", "20-24", "25-29", 
    "30-34", "35-39", "40-44", "45-49", "50-54", "55-59", "60 and over"))

nnx$dur = str_replace(nnx$AGE_DUR_NAME, ".* claiming (.*)", "\\1")
nnx$dur = factor(nnx$dur)
nnx$dur = factor(nnx$dur, levels = c("one week or less", "over 1 and up to 2 weeks", 
    "over 2 and up to 4 weeks", "over 4 and up to 6 weeks", "over 6 and up to 8 weeks", 
    "over 8 and up to 13 weeks", "over 13 and up to 26 weeks", "over 26 and up to 39 weeks", 
    "over 39 and up to 52 weeks", "over 52 and up to 65 weeks", "over 65 and up to 78 weeks", 
    "over 78 and up to 104 weeks", "over 104 and up to 156 weeks", "over 156 and up to 208 weeks", 
    "over 208 and up to 260 weeks", "over 260 weeks"))
ggplot(nnx) + geom_line(aes(x = dur, y = OBS_VALUE, group = ad, col = ad)) + 
    facet_wrap(~SEX_NAME + DATE) + theme(axis.text.x = element_text(angle = 45, 
    hjust = 1))

plot of chunk unnamed-chunk-14


ggplot(nnx[nnx$DATE == "2013-10", ]) + geom_line(aes(x = dur, y = OBS_VALUE, 
    group = SEX_NAME, col = SEX_NAME)) + facet_wrap(~ad) + theme(axis.text.x = element_text(angle = 45, 
    hjust = 1))

plot of chunk unnamed-chunk-14