This function downloads a .csv file representing movement between MSOA zones in England and Wales. By default it returns national data, but region can be set to subset the output to a specific local authority or region.

get_od(
  region = NULL,
  n = NULL,
  type = "within",
  omit_intrazonal = FALSE,
  base_url = paste0("https://s3-eu-west-1.amazonaws.com/",
    "statistics.digitalresources.jisc.ac.uk", "/dkan/files/FLOW/"),
  filename = "wu03ew_v2",
  u = NULL
)

Arguments

region

The PCT region or local authority to download data from (e.g. west-yorkshire or Leeds). See View(pct_regions_lookup) for a full list of possible region names.

n

top n number of destinations with most trips in the 2011 census within the region.

type

the type of subsetting: one of from, to or within, specifying how the od dataset should be subset in relation to the region.

omit_intrazonal

should intrazonal OD pairs be omited from result? FALSE by default.

base_url

the base url where the OD dataset is stored

filename

the name of the file to download, if not the default MSOA level data.

u

full url of file to download

Details

OD datasets available include wu03uk_v3 and others listed on the Wicid website.

Examples

# \donttest{
get_od("wight", n = 3)
#> Rows: 2402201 Columns: 14
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (2): Area of residence, Area of workplace
#> dbl (12): All categories: Method of travel to work, Work mainly at or from h...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 7201 Columns: 6
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): MSOA11CD, MSOA11NM
#> dbl (4): BNGEAST, BNGNORTH, LONGITUDE, LATITUDE
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 3 × 18
#>   geo_code1 geo_code2   all from_home light_rail train   bus  taxi motorbike
#>   <chr>     <chr>     <dbl>     <dbl>      <dbl> <dbl> <dbl> <dbl>     <dbl>
#> 1 E02003592 E02003592  1164         0          0     1    41     3        10
#> 2 E02003589 E02003589   875         0          0     0    12     1         8
#> 3 E02003591 E02003589   852         0          0     1     6     0        11
#> # ℹ 9 more variables: car_driver <dbl>, car_passenger <dbl>, bicycle <dbl>,
#> #   foot <dbl>, other <dbl>, geo_name1 <chr>, geo_name2 <chr>, la_1 <chr>,
#> #   la_2 <chr>
get_od()
#> No region provided. Returning national OD data.
#> Rows: 2402201 Columns: 14
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (2): Area of residence, Area of workplace
#> dbl (12): All categories: Method of travel to work, Work mainly at or from h...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 7201 Columns: 6
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): MSOA11CD, MSOA11NM
#> dbl (4): BNGEAST, BNGNORTH, LONGITUDE, LATITUDE
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 2,402,201 × 18
#>    geo_code1 geo_code2   all from_home light_rail train   bus  taxi motorbike
#>    <chr>     <chr>     <dbl>     <dbl>      <dbl> <dbl> <dbl> <dbl>     <dbl>
#>  1 E02000001 E02000001  1506         0         73    41    32     9         1
#>  2 E02000001 E02000014     2         0          2     0     0     0         0
#>  3 E02000001 E02000016     3         0          1     0     2     0         0
#>  4 E02000001 E02000025     1         0          0     1     0     0         0
#>  5 E02000001 E02000028     1         0          0     0     0     0         0
#>  6 E02000001 E02000051     1         0          1     0     0     0         0
#>  7 E02000001 E02000053     2         0          2     0     0     0         0
#>  8 E02000001 E02000057     1         0          1     0     0     0         0
#>  9 E02000001 E02000058     1         0          0     0     0     0         0
#> 10 E02000001 E02000059     1         0          0     0     0     1         0
#> # ℹ 2,402,191 more rows
#> # ℹ 9 more variables: car_driver <dbl>, car_passenger <dbl>, bicycle <dbl>,
#> #   foot <dbl>, other <dbl>, geo_name1 <chr>, geo_name2 <chr>, la_1 <chr>,
#> #   la_2 <chr>
get_od(filename = "wu03uk_v3")
#> No region provided. Returning national OD data.
#> Rows: 110162 Columns: 14
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (2): Area of usual residence, Area of workplace
#> dbl (12): All categories: Method of travel to work, Work mainly at or from h...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 110,162 × 14
#>    ``    geo_code2   all from_home light_rail train   bus  taxi motorbike
#>    <chr> <chr>     <dbl>     <dbl>      <dbl> <dbl> <dbl> <dbl>     <dbl>
#>  1 95AA  95AA       9465         0          0    12   243   421        58
#>  2 95AA  95BB        107         0          0     0     1     2         0
#>  3 95AA  95CC         42         0          0     0     1     0         0
#>  4 95AA  95DD       1485         0          0    11    84    13         8
#>  5 95AA  95EE         35         0          0     0     1     0         0
#>  6 95AA  95FF         18         0          0     0     0     0         0
#>  7 95AA  95GG       4538         0          0   165   434    14        23
#>  8 95AA  95HH        139         0          0     1     1     0         0
#>  9 95AA  95II        282         0          0     2    15     0         0
#> 10 95AA  95JJ        108         0          0    15     2     0         0
#> # ℹ 110,152 more rows
#> # ℹ 5 more variables: car_driver <dbl>, car_passenger <dbl>, bicycle <dbl>,
#> #   foot <dbl>, other <dbl>
u = "https://www.nomisweb.co.uk/output/census/2011/wf02ew_oa.zip"
# get_od(u = u)
# }