Package 'uklr'

Title: Client to United Kingdom Land Registry
Description: Access data from Land Registry Open Data <http://landregistry.data.gov.uk/> through 'SPARQL' queries. 'uklr' supports the house price index, transaction and price paid data.
Authors: Kostas Vasilopoulos [aut, cre]
Maintainer: Kostas Vasilopoulos <[email protected]>
License: GPL-3
Version: 1.0.2
Built: 2025-03-09 04:11:14 UTC
Source: https://github.com/kvasilopoulos/uklr

Help Index


Office of National Statistic Location Classification

Description

Functions ons_countries, ons_regions, ons_eng_counties and ons_la provide a vector of countries, regions, English counties and local authorities respectively.

Usage

ons_countries(modify = TRUE)

ons_eng_regions(modify = TRUE)

ons_regions(modify = TRUE)

ons_eng_counties(modify = TRUE)

ons_la(modify = FALSE)

Arguments

modify

Modifies the vector to conform with the queries.

Value

A character vector with the location names.

Examples

ons_countries()

Office of National Statistic Location Classification

Description

ons_lookup provides a table that that combines local authority districts (lad), local administrative units (lau), nomenclature of territorial units for statistics(NUTS) 1,2 and 3. The other functions can extract the mentioned variables.

Usage

ons_lookup()

ons_nuts1()

ons_nuts2()

ons_nuts3()

ons_lad()

Value

A character vector with the location names.

Examples

ons_lookup()

UK Postcodes

Description

Vector of UK postcodes. Search for matches with the 'pattern' argument.

Usage

ons_pc(pattern = NULL)

Arguments

pattern

partial matching

Details

ons_pc("EH21 8A")


UK Postcodes and NUTS3 Codes

Description

UK Postcodes and NUTS3 Codes

Usage

pc

Format

An object of class spec_tbl_df (inherits from tbl_df, tbl, data.frame) with 1759911 rows and 2 columns.

Examples

pc

Get the sparql query performed with sparql.

Description

Get the sparql query performed with sparql.

Usage

retrieve_query(x)

Arguments

x

the result of query.

Value

Returns the a character vector with the query.


Tools to create a custom SPARQL query

Description

Function to create custom queries with the '/landregistry/query endpoint'. All necessary prefixes have to be included and output will be parsed from json to dataframe. The most prefixes from land registry can be include with prefix_query.

Usage

sparql(
  query,
  endpoint = "http://landregistry.data.gov.uk/landregistry/query",
  ...
)

prefix_query(query)

Arguments

query

custom query.

endpoint

land registry's web service endpoint.

...

further arguments passed to httr::GET.

Value

Returns a tibble that has been parsed from json.

Examples

custom_query <- "select * where {
  <http://landregistry.data.gov.uk/data/ukhpi/region/newport/month/2013-10> ?property ?value
}"
sparql(prefix_query(custom_query))

Display Land Registry available categories

Description

ukhp_avail_regions() displays available regions, ukhp_avail_regions() displays available items, ukhp_avail_date_span() displays available date sample, and ukhp_avail_date_last displays the last available date.

Usage

ukhp_avail_items()

ukhp_avail_regions()

ukhp_avail_date_span()

ukhp_avail_date_last()

Value

Returns a character vector.

Examples

ukhp_avail_regions()[1:10]
ukhp_avail_items()
ukhp_avail_date_last()

Get House Price Data

Description

The UK House Price Index (UK HPI) captures changes in the value of residential properties. The UK HPI uses sales data collected on residential housing transactions, whether for cash or with a mortgage. Data is available at a national and regional level, as well as counties, local authorities and London boroughs.

Usage

ukhp_get(
  region = "england",
  item = "housePriceIndex",
  regexp = FALSE,
  start_date = NULL,
  end_date = NULL,
  ...
)

Arguments

region

the region to select. If regexp is set to FALSE then the matching should be exact, see ukhp_avail_regions for available regions. If regexp is set to TRUE then partial matching is possible. Furthermore if it is set to NULL then selects all available regions.

item

the item to select. See ukhp_avail_items for the available categories.

regexp

use regular expression in sparql to search for regions.

start_date

the start date as YYYY-MM-DD.

end_date

the end date as YYYY-MM-DD.

...

query modifiers passed through rdf_modifiers.

Details

Properties have been included:

  • in England and Wales since January 1995

  • in Scotland since January 2004

  • in Northern Ireland since January 2005

Value

Returns a tibble in long format.

See Also

rdf_modifiers

Examples

# This is case sensitive
ukhp_get("england")

# However you can use regular expression instead of exact match
ukhp_get("england", regexp = TRUE)

# For all available items
ukhp_avail_items()

ukhp_get(c("england", "wales"), item = c("salesVolume", "housePriceIndexDetached"))

Quickly browse to Land Registry's webpage

Description

These functions take you to land registry's webpages and return the URL invisibly.

Usage

uklr_browse()

ukhp_browse()

ukppd_browse()

uktrans_browse()

Examples

uklr_browse()

Linked Data Definitions

Description

These functions return the definitions for the linked data construction in a tibble.

Usage

uklr_def()

ukhp_def()

ukppd_def()

uktrans_def()

Value

Returns a tibble.

Examples

uklr_def()

ukhp_def()

Display Price Paid Date available categories

Description

ukppd_avail_items() displays all available items for search, ukppd_avail_optional_items() displays optional items that refer to the location of the transaction and ukppd_avail_postcodes displays the available postcodes. /

Usage

ukppd_avail_items()

ukppd_avail_optional_items()

ukppd_avail_postcodes()

Value

Returns a character vector.

Examples

ukppd_avail_items()

ukppd_avail_optional_items()

ukppd_avail_postcodes()[1:10]

Get Price Paid Data

Description

Price Paid Data tracks property sales in England and Wales submitted to HM Land Registry for registration. Price Paid Data is based on the raw data released each month.

Usage

ukppd_get(
  postcode = "PL6 8RU",
  item = NULL,
  optional_item = NULL,
  start_date = NULL,
  end_date = NULL,
  ...
)

Arguments

postcode

postcode to select, see ukppd_avail_postcode() for available postcodes.

item

item to select, see ukppd_avail_items() for available items.

optional_item

optional item to select that describes the location of the transaction, , see ukppd_avail_optional_items() for available items.

start_date

the start date as YYYY-MM-DD.

end_date

the end date as YYYY-MM-DD.

...

query modifiers passed through rdf_modifiers.

Value

Returns a tibble in long format.

Examples

ukppd_get("PL6 8RU")

ukppd_get("PL6 8RU", start_date = "2001-01-01")

ukppd_get("PL6 8RU", item = "newBuild", optional_item = "street")

Display Land Registry Transaction available categories

Description

uktrans_avail_items() and uktrans_avail_regions() display available items and regions for search respectively.

Usage

uktrans_avail_items()

uktrans_avail_regions()

Value

Returns a character vector.

Examples

uktrans_avail_items()
uktrans_avail_regions()

Get Transaction Data

Description

Transaction Data is a dataset that shows how many customer applications we completed, in the preceding month for: first registrations, leases, transfers of part, dealings, official copies and searches. This is based on customer and location.

Usage

uktrans_get(
  item = "totalApplicationCountByRegion",
  region = NULL,
  regexp = TRUE,
  start_date = NULL,
  end_date = NULL,
  ...
)

Arguments

item

item to select, see uktrans_avail_items() for available items.

region

region to select, see uktrans_avail_regions() for available regions.

regexp

use regular expression in sparql to search for regions.

start_date

the start date as YYYY-MM-DD.

end_date

the end date as YYYY-MM-DD.

...

query modifiers passed through rdf_modifiers.

Value

Returns a tibble in long format.

Examples

uktrans_get(item = "totalApplicationCountByRegion", region = "East Anglia")

# If `region` is left as NULL then it returns all available regions
uktrans_get(item = "totalApplicationCountByRegion")

# Quering all available transaction data
uktrans_get(item = uktrans_avail_items())