This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ONS datasets can be found at | |
# http://www.ons.gov.uk/ons/datasets-and-tables/index.html | |
# (Filter out reference tables at the right of the page) | |
library(reshape2) | |
library(plyr) | |
library(ggplot2) | |
# This is the time-consuming part. To get the maximum use out of your data, | |
# create a CSV file listing CDIDs (variable codes) and some metadata. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
nomis <- read.csv('http://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.data.csv?geography=1941962826...1941962836&date=latestMINUS156,latestMINUS144,latestMINUS132,latestMINUS120,latestMINUS108,latestMINUS96,latestMINUS84,latestMINUS72,latestMINUS60,latestMINUS48,latestMINUS36,latestMINUS24,latestMINUS12,latest&sex=5...7&item=1&measures=20100,20203&select=date_name,geography_name,geography_code,sex_name,item_name,measures_name,obs_value,obs_status_name') | |
dates <- paste("1", nomis$DATE_NAME) | |
nomis$date <- as.Date(dates, format <- "%d %B %Y") | |
cc_rate <- subset(nomis, MEASURES_NAME=='Proportion of resident population aged 16-64 estimates') | |
# reorder the data | |
most_recent_cc_rates <- subset(cc_rate, date==max(date) & SEX_NAME=='Total') | |
order_for_names <- rev(order(most_recent_cc_rates$OBS_VALUE)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script plots the youth unemployment rate in EU countries. | |
# Note that there are time series breaks and some values are | |
# estimated. This is shown in the 'flag' column but not on the chart. | |
# To get the data, follow this bookmarked link and download the data as csv: | |
# http://appsso.eurostat.ec.europa.eu/nui/show.do?query=BOOKMARK_DS-055628_QID_605AF573_UID_-3F171EB0&layout=TIME,C,X,0;SEX,L,Y,0;GEO,B,Y,1;S_ADJ,L,Z,0;AGE,L,Z,1;INDICATORS,C,Z,2;&zSelection=DS-055628AGE,Y_LT25;DS-055628INDICATORS,OBS_FLAG;DS-055628S_ADJ,SA;&rankName1=AGE_1_2_-1_2&rankName2=S-ADJ_1_2_-1_2&rankName3=INDICATORS_1_2_-1_2&rankName4=TIME_1_0_0_0&rankName5=SEX_1_2_0_1&rankName6=GEO_1_2_1_1&sortC=ASC_-1_FIRST&rStp=&cStp=&rDCh=&cDCh=&rDM=true&cDM=true&footnes=false&empty=false&wai=false&time_mode=ROLLING&time_most_recent=false&lang=EN&cfo=%23%23%23%2C%23%23%23.%23%23%23 | |
library(ggplot2) | |
library(scales) | |
library(zoo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# eurostat_r.r should be in the working directory. | |
# See http://johanneskutsam.blogspot.co.uk/2012/10/eurostat-in-r-in-git.html | |
library(ggplot2) | |
library(scales) | |
source('eurostat_r.r') | |
eu_codes <- c('BE', 'BG', 'CZ', 'DK', 'DE', 'EE', 'IE', 'EL', 'ES', | |
'FR', 'HR', 'IT', 'CY', 'LV', 'LT', 'LU', 'HU', 'MT', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to create data for http://ukdataexplorer.com/census/ | |
# Author James Trimble, james.trimble at yahoo.co.uk | |
# | |
# This code is based on Alex Singleton's work: | |
# http://rpubs.com/alexsingleton/openatlas | |
# http://www.alex-singleton.com/2011-census-open-atlas-project/ | |
# | |
# The script takes around an hour to run. It could be made faster! | |
# The script requires a lookup table and shapefile from | |
# https://geoportal.statistics.gov.uk/geoportal/catalog/search/browse/browse.page |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AAL": { | |
"city": "Aalborg", | |
"country": "Denmark", | |
"long_lat": [ | |
"9.849164", | |
"57.092789" | |
], | |
"name": "Aalborg", | |
"routes": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage | |
// node reduce.js worldmap.geojson 3 | |
var fs = require('fs') | |
var json_string = fs.readFileSync(process.argv[2]) | |
var precision = parseInt(process.argv[3]) | |
console.log('original length: ' + json_string.length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap <C-P> :!evince ~/Papers/pdf/<cfile>:t.pdf &<CR> |