Getting Started with nomisdata

Introduction

The nomisdata package provides easy access to UK official statistics from the Nomis database, including:

Installation

# From CRAN
install.packages("nomisdata")

# Development version
# install.packages("remotes")
remotes::install_github("yourname/nomisdata")

Basic Workflow

1. Search for Datasets

library(nomisdata)

# Search by name
employment <- search_datasets(name = "*employment*")
head(employment)

# Search by keywords
census <- search_datasets(keywords = "census")

2. Explore Dataset Structure

# Get dataset information
describe_dataset("NM_1_1")

# Get available concepts/dimensions
concepts <- get_codes("NM_1_1")
print(concepts)

3. Get Code Options

# Get geography codes
geographies <- get_codes("NM_1_1", "geography")
head(geographies)

# Search for specific geography
london <- lookup_geography("London")
print(london)

# Get measure codes
measures <- get_codes("NM_1_1", "measures")
print(measures)

4. Download Data

# Latest JSA data by country
jsa_data <- fetch_nomis(
  id = "NM_1_1",
  time = "latest",
  geography = "TYPE499",  # Countries
  measures = 20100,        # Claimants
  sex = 7                  # Total
)

head(jsa_data)

Using Example Data

For offline work, use the included sample dataset:

library(nomisdata)
data(jsa_sample)
head(jsa_sample)
#> # A tibble: 3 × 13
#>   GEOGRAPHY_CODE GEOGRAPHY_NAME   SEX SEX_NAME  ITEM ITEM_NAME     MEASURES
#>   <chr>          <chr>          <int> <chr>    <int> <chr>            <int>
#> 1 2092957697     United Kingdom     7 Total        1 JSA claimants    20100
#> 2 2092957698     Great Britain      7 Total        1 JSA claimants    20100
#> 3 2092957699     England            7 Total        1 JSA claimants    20100
#> # ℹ 6 more variables: MEASURES_NAME <chr>, DATE <chr>, DATE_NAME <chr>,
#> #   OBS_VALUE <dbl>, OBS_STATUS <chr>, RECORD_COUNT <int>

API Key Setup

For higher rate limits (100,000 vs 25,000 rows):

# Register at: https://www.nomisweb.co.uk/myaccount/userjoin.asp

# Set for current session
set_api_key("your-api-key")

# Or save to .Renviron for persistence
set_api_key("your-api-key", persist = TRUE)

Next Steps