Downloads multiple resources from a dataset on the NHS Open Data platform by dataset name, with optional row limits and context columns.
get_dataset(
dataset_name,
max_resources = NULL,
rows = NULL,
row_filters = NULL,
col_select = NULL,
include_context = FALSE
)
Name of the dataset as found on NHS Open Data platform (character).
(optional) The maximum number of resources to return (integer). If not set, all resources are returned.
(optional) Maximum number of rows to return (integer).
(optional) A named list or vector specifying values of columns/fields to keep (e.g., list(Date = 20220216, Sex = "Female")).
(optional) A character vector containing the names of desired columns/fields (e.g., c("Date", "Sex")).
(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.
A tibble with the data.
get_resource()
for downloading a single resource from a dataset.
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 20250401 10002 S08000030 S3700… Male "" 4148 "" 170
#> 2 20250401 10002 S08000030 S3700… Fema… "" 4272 "" 165
#> 3 20250401 10002 S08000030 S3700… All "d" 8420 "" 335
#> 4 20250401 10017 S08000030 S3700… Male "" 3808 "" 132
#> 5 20250401 10017 S08000030 S3700… Fema… "" 3815 "" 120
#> 6 20250401 10017 S08000030 S3700… All "d" 7623 "" 252
#> 7 20250401 10036 S08000030 S3700… Male "" 2452 "" 87
#> 8 20250401 10036 S08000030 S3700… Fema… "" 2406 "" 58
#> 9 20250401 10036 S08000030 S3700… All "d" 4858 "" 145
#> 10 20250401 10106 S08000030 S3700… Male "" 3094 "" 98
#> 11 20250101 10002 S08000030 S3700… Male "" 4118 "" 168
#> 12 20250101 10002 S08000030 S3700… Fema… "" 4248 "" 170
#> 13 20250101 10002 S08000030 S3700… All "d" 8366 "" 338
#> 14 20250101 10017 S08000030 S3700… Male "" 3778 "" 133
#> 15 20250101 10017 S08000030 S3700… Fema… "" 3778 "" 123
#> 16 20250101 10017 S08000030 S3700… All "d" 7556 "" 256
#> 17 20250101 10036 S08000030 S3700… Male "" 2446 "" 90
#> 18 20250101 10036 S08000030 S3700… Fema… "" 2406 "" 54
#> 19 20250101 10036 S08000030 S3700… All "d" 4852 "" 144
#> 20 20250101 10106 S08000030 S3700… Male "" 3092 "" 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>