Skip to contents

Get Open Data resources from a dataset

Usage

get_dataset(
  dataset_name,
  max_resources = NULL,
  rows = NULL,
  row_filters = NULL,
  col_select = NULL,
  include_context = FALSE
)

Arguments

dataset_name

name of the dataset as found on NHS Open Data platform

max_resources

(optional) the maximum number of resources to return, use for testing code, it will return the n latest resources

rows

(optional) specify the max number of rows to return for each resource.

row_filters

(optional) a named list or vector that specifies values of columns/fields to keep. e.g. list(Date = 20220216, Sex = "Female").

col_select

(optional) a character vector containing the names of desired columns/fields. e.g. c("Date", "Sex").

include_context

(optional) If TRUE additional information about the resource will be added as columns to the data, including the resource ID, the resource name, the creation date and the last modified/updated date.

Value

a tibble with the data

See also

get_resource() for downloading a single resource from a dataset.

Examples

get_dataset("gp-practice-populations",
  max_resources = 2, rows = 10
)
#> # A tibble: 20 × 24
#>        Date PracticeCode HB        HSCP   Sex   SexQF AllAges AllAgesQF Ages0to4
#>       <int>        <int> <chr>     <chr>  <chr> <chr>   <int> <chr>        <int>
#>  1 20241001        10002 S08000030 S3700… Male  ""       4109 ""             173
#>  2 20241001        10002 S08000030 S3700… Fema… ""       4221 ""             172
#>  3 20241001        10002 S08000030 S3700… All   "d"      8330 ""             345
#>  4 20241001        10017 S08000030 S3700… Male  ""       3742 ""             136
#>  5 20241001        10017 S08000030 S3700… Fema… ""       3721 ""             119
#>  6 20241001        10017 S08000030 S3700… All   "d"      7463 ""             255
#>  7 20241001        10036 S08000030 S3700… Male  ""       2452 ""              96
#>  8 20241001        10036 S08000030 S3700… Fema… ""       2412 ""              56
#>  9 20241001        10036 S08000030 S3700… All   "d"      4864 ""             152
#> 10 20241001        10106 S08000030 S3700… Male  ""       3106 ""              96
#> 11 20240701        10002 S08000030 S3700… Male  ""       4072 ""             179
#> 12 20240701        10002 S08000030 S3700… Fema… ""       4188 ""             175
#> 13 20240701        10002 S08000030 S3700… All   "d"      8260 ""             354
#> 14 20240701        10017 S08000030 S3700… Male  ""       3697 ""             136
#> 15 20240701        10017 S08000030 S3700… Fema… ""       3657 ""             116
#> 16 20240701        10017 S08000030 S3700… All   "d"      7354 ""             252
#> 17 20240701        10036 S08000030 S3700… Male  ""       2449 ""              94
#> 18 20240701        10036 S08000030 S3700… Fema… ""       2407 ""              55
#> 19 20240701        10036 S08000030 S3700… All   "d"      4856 ""             149
#> 20 20240701        10106 S08000030 S3700… Male  ""       3100 ""              92
#> # ℹ 15 more variables: Ages0To4QF <chr>, Ages5to14 <int>, Ages5To14QF <chr>,
#> #   Ages15to24 <int>, Ages15To24QF <chr>, Ages25to44 <int>, Ages25To44QF <chr>,
#> #   Ages45to64 <int>, Ages45To64QF <chr>, Ages65to74 <int>, Ages65To74QF <chr>,
#> #   Ages75to84 <int>, Ages75To84QF <chr>, Ages85plus <int>, Ages85PlusQF <chr>