Skip to contents

Data sets

Data sets exported in the package

ons_geog_shorthands
Lookup for ONS geography columns shorthands
wd_pcon_lad_la_rgn_ctry
Ward to Constituency to LAD to LA to Region to Country lookup
countries
Lookup for valid country names and codes
regions
Lookup for valid region names and codes
geog_time_identifiers
Potential names for geography and time columns

Database connection

Helpful functions for connecting to databases in DfE

get_clean_sql()
Get a cleaned SQL script into R

Fetch geography lists

Pull geography lookups from the ONS Geography Portal

fetch_pcons()
Fetch Westminster parliamentary constituencies
fetch_countries()
Fetch countries
fetch_lads()
Fetch local authority districts
fetch_las()
Fetch local authorities
fetch_regions()
Fetch regions
fetch_wards()
Fetch wards

Presentation prettifiers

Functions for presenting pretty versions of numbers with readable code

pretty_filesize()
Pretty numbers into readable file size
pretty_num()
Prettify big numbers into a readable format
pretty_num_table()
Format a data frame with dfeR::pretty_num().
pretty_time_taken()
Calculate elapsed time between two points and present prettily

Pre-populated project

A function to create a new R project with a pre-populated folder and file structure

create_project()
Creates a pre-populated project for DfE R

Specific formats

Functions for converting to specific formats

format_ay()
Format academic year
format_ay_reverse()
Undo academic year formatting
format_fy()
Format financial year
format_fy_reverse()
Undo financial year formatting

Helpers

Functions used in other functions across the package, exported as they can also be useful in their own right

round_five_up()
Round five up
comma_sep()
Comma separate
get_ons_api_data()
Fetch ONS Open Geography API data
toggle_message()
Controllable console messages

Replace NA values

Replace NA values with the default ā€œzā€ or an alternative replacement

z_replace()
Replaces NA values in tables