Package 'cdrcR'

Title: Load 'CDRC' Data
Description: A wrapper for the 'CDRC' 'API' that returns data frames or 'sf' of 'CDRC' data. The 'API' web reference is:<https://api.cdrc.ac.uk/swagger/index.html>.
Authors: Alessia Calafiore [aut, cre]
Maintainer: Alessia Calafiore <[email protected]>
License: GPL-3
Version: 0.1.1
Built: 2024-07-18 06:28:29 UTC
Source: CRAN

Help Index


Get data from the CDRC

Description

Obtain data from the CDRC datasets. To find out what datasets are available and their respective dataCode run listCDRC().

Usage

getCDRC(
  dataCode,
  geography = c("postcode", "MSOA", "LSOA", "LAD", "LADname"),
  geographyCode,
  boundaries = FALSE
)

Arguments

dataCode

A character-string API identifier associated which each dataset in the CDRC. To find out the dataCode of your desired dataset run listCDRC().

geography

The geographical levels in which the data can be retrieved. It can be postcode, MSOA, LSOA, LAD or LADname. Note that the geography in which the data are retrieved does not necessarily correspond with the geography of the data. For example, it is possible to query data of the AHAH index by postcodes although the index is originally at LSOA level. Therefore you will see returned the LSOAs that better match the required postcodes.

geographyCode

A character-vector of one or more postcodes, LSOA codes, MSOA codes, LAD codes or LAD names.

boundaries

if FALSE (the default), returns a data frame of the desired data. if TRUE, uses the Open Geography Portal API to return an sf with the 'geometry' column.

Value

A dataframe or sf depending whether boundaries are set to FALSE or TRUE respectively.

Examples

## Not run: 
ahah_data <- getCDRC("AHAHOverallIndexDomain",geography = "postcode",
geographyCode = c("CH430UQ","LS61EF","L83UL"), boundaries = TRUE)
View(ahah_data)
plot(ahah_data$geometry)

## End(Not run)

This function returns a list of all CDRC datasets that can be retrieved with this package. This function takes no arguments.

Description

This function returns a list of all CDRC datasets that can be retrieved with this package. This function takes no arguments.

Usage

listCDRC()

Value

A dataframe of the datasets available to request with the API.

Examples

## Not run: 
dataset_list <- listCDRC()
View(dataset_list)

## End(Not run)

Liverpool LSOA boundaries

Description

A dataset containing Lower Layer Super Output Areas in Liverpool Local Authority

Usage

liverpool

Format

A simple feature object with 297 rows and 7 variables:

OBJECTID

Geographical Feature ID

LSOA11CD

LSOA Codes

LSOA11NM

LSOA Names

LSOA11NMW

LSOA Names in Welsh

Shape_Are

LSOA Area

Shape_Len

LSOA Length

geom

Simple Feature Geometry

Source

https://geoportal.statistics.gov.uk/


Login to the CDRC

Description

This function will log in a CDRC user based on the username and password. If you do not have a CDRC user yet, please register on https://apps.cdrc.ac.uk/datasetportal/Identity/Account/Register When you log in an api token is automatically generated, saved in your R environment and loaded, no further action is required from you to access the API.

Usage

loginCDRC(username, password)

Arguments

username

A character-string with your CDRC username.

password

A character-string with your CDRC password.

Details

For safety reasons the API token will expire in 24h. This means that after 24h you need to log in again to generate a new API token which will be self-updated and load.

Value

A response message which confirms the login was successful and how to see the API key.

Examples

## Not run: 
loginCDRC(name='your-username',password='your-password')

## End(Not run)