UKGeographyProvider: UK Geography

Description Super classes Methods

Description

UK Geography

UK Geography

Super classes

ukcovidtools::PassthroughFilesystemCache -> ukcovidtools::DataProvider -> UKGeographyProvider

Methods

Public methods

Inherited methods

Method new()

Usage
UKGeographyProvider$new(providerController, ...)

Method getMapList()

Usage
UKGeographyProvider$getMapList()

Method getMap()

get a map as an sf object

Usage
UKGeographyProvider$getMap(mapId, ...)
Arguments
codeType

the map you want


Method getPHEDashboardMap()

Usage
UKGeographyProvider$getPHEDashboardMap(...)

Method getIntersection()

Usage
UKGeographyProvider$getIntersection(
  inputMapId,
  inputShape = self$getMap(inputMapId),
  outputMapId,
  outputShape = self$getMap(outputMapId),
  ...
)

Method getContainedIn()

Usage
UKGeographyProvider$getContainedIn(
  inputSf,
  outputShape = self$getMap(outputMapId),
  outputMapId = NA,
  inputIdVar = "code",
  outputIdVar = "code"
)

Method interpolateByArea()

interpolate a variable from one set of shapes to another

Usage
UKGeographyProvider$interpolateByArea(
  inputDf,
  inputMapId,
  inputShape = self$getMap(inputMapId),
  inputIdVar = "code",
  interpolateVar,
  outputMapId,
  outputShape = self$getMap(outputMapId) %>% dplyr::group_by(codeType, code, name),
  outputVars = outputShape %>% dplyr::groups(),
  aggregateFn = sum
)
Arguments
inputDf

- a grouped dataframe containing the statistic to be interpolated

inputShape

- an input map,

inputIdVar

- an id shared between the grouped data fram and the input map,

interpolateVar

- the statistic,

outputShape

- an output map which must be grouped by the desired output,

Returns

a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar


Method createNeighbourNetwork()

create a neighbourhood network from a shapefile

Usage
UKGeographyProvider$createNeighbourNetwork(
  mapId,
  shape = self$getMap(mapId) %>% dplyr::group_by(code, name),
  idVar = "code",
  ...
)
Arguments
mapId

- a the ID of the map

shape

- a sf object, if not present will be loaded from cache

idVar

- the varable containing the coded identifier of the map

Returns

an edge list of ids with from and to columns


Method standardiseMap()

standardise all maps to a minimal set of attributes with consistent naming

Usage
UKGeographyProvider$standardiseMap(sf, codeCol, nameCol, altCodeCol, codeType)

Method saveShapefile()

save a shapefile to disk in the current working directory

Usage
UKGeographyProvider$saveShapefile(
  mapId,
  shape = self$getMap(mapId),
  overwrite = FALSE
)
Arguments
mapId

- a mapId - will become the zip filename

-

a zip directory

Returns

a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar


Method loadAllMaps()

warm up caches

Usage
UKGeographyProvider$loadAllMaps()

Method createCatchment()

create a catchment area map from

Usage
UKGeographyProvider$createCatchment(
  supplyShape,
  supplyIdVar = "code",
  supplyVar,
  supplyOutputVars = supplyShape %>% dplyr::groups(),
  demandId,
  demandShape,
  demandIdVar = "code",
  demandVar,
  growthRates = function(capacityPerDemand, multiplier = 1.1) {    
    return(rank(capacityPerDemand)/length(capacityPerDemand) * multiplier) },
  distanceModifier = function(distanceToSupply) {     return(2/(1 +
    distanceToSupply/min(0.1, mean(distanceToSupply)))) },
  tweakNetwork = self$sources$tweak$DEMOG,
  outputMap = TRUE
)
Arguments
supplyShape

- a sf object containing a list of the locations of supply points, with a column containing supply capacity, for example NHS hospital sites, with a bed

supplyIdVar

- the variable name of the identifier of the supplier or group of suppliers. For example this could be an NHS trust (multiple sites)

supplyVar

- the column name of the supply parameter. This could be number of beds in a hospital.

supplyOutputVars

- the columns from the input that are to be retained in the output

demandShape

- the sf object with the geographical map of the demand surface. For example the geographical distribution of the population served,

demandIdVar

- the column name of the unique identifier of the areas,

demandVar

- the column name of the demand parameter. This could be the population in each region

growthRates

- a function to calculate

distanceModifier

- distance modifier

tweakNetwork

- a named list containing extra linkages beyond those inferred by the demandShape topology. These are used to add in bridges

outputMap

- catch

Returns

a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar


Method preview()

Usage
UKGeographyProvider$preview(
  shape = self$getMap(mapId),
  mapId = NA,
  nameVar = "name",
  codeVar = "code",
  poi = NULL,
  poiNameVar = "name",
  poiCodeVar = "code"
)

Method plot()

Usage
UKGeographyProvider$plot(shape = self$getMap(mapId), mapId = NA)

Method clone()

The objects of this class are cloneable with this method.

Usage
UKGeographyProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


terminological/uk-covid-datatools documentation built on June 24, 2021, 8:16 p.m.