postcodetolatlong: postcodetolatlong

Description Usage Arguments Details Value Author(s)

View source: R/postcodetolatlong.R

Description

postcodetolatlong is a macro (rather than a function) which appends a coarse latitude and longitude of the patient's home address (using the outer portion of the postcode only)

Usage

1
postcodetolatlong(data_table)

Arguments

data_table

A tibble (optimised data frame) containing S1PostcodeOut.

Details

This macro takes as input a tibble (an optimised data frame; see the tibble package).

The tibble should contain a column labelled S1PostcodeOut representing the time of clock start for the patient at the admitting hospital, and S2BrainImagingDateTime representing the time of first imaging.

The tibble is updated with a new column containing the times in minutes between these values, expressed as numerics.

The best place for this to be calculated is at record creation, rather than in routine analysis. The function exists where we do not have the facility to calculate the value on record creation.

This function uses a postcode CSV file, postcode-outcodes.csv, obtained from https://www.freemaptools.com/download-uk-postcode-lat-lng.htm .

Using outer postcodes only should be sufficent for most forms of aggregated data and mapping. The likely exceptions to this rule are modelling of transport times or more detailed mapping: however checking coordinates using a full postcode could be extremely processor-intensive as the postcode map is several orders of magnitude larger.

Postcode data is provided under license from the National Archives and contains public sector information licensed under the Open Government License version 3.0 http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/

Value

Longitudes and latitudes where known based upon outer portion of postcode, in the new columns S1PostcodeOutLatitude and S1PostcodeOutLongitude.

Author(s)

Andrew Hill, andrew.hill@doctors.org.uk


md0u80c9/SSNAPStats documentation built on Feb. 11, 2020, 11:43 a.m.