Skip to contents

This function is mostly designed for exploring the API, and is unlikely to be suitable for long term production use.

You can set the number of rows to preview using the n_max parameter. This uses the n_max from readr::read_csv() under the hood.

As there are no IDs involved, this is brittle and code relying on this function will likely break whenever there is renaming of variables or items in the data.

It is recommended to take the time to set up custom queries using the query_dataset() function instead.

If you are using this function for more than exploratory purposes, make sure you subscribe to the data set you're downloading and then keep track of any updates to the data.

Usage

preview_dataset(
  dataset_id,
  dataset_version = NULL,
  api_version = NULL,
  n_max = 10,
  verbose = FALSE
)

Arguments

dataset_id

ID of data set

dataset_version

Version number of data set

api_version

EES API version

n_max

maximum number of rows to preview, 10 by default, Inf will get all available rows

verbose

Run with additional contextual messaging, logical, default = FALSE

Value

data.frame

Details

This gives a super quick way to just fetch the file in a human readable format.

Examples

# Preview first 10 rows
preview_dataset(example_id("dataset"))
#>    time_period time_identifier geographic_level country_code country_name
#> 1       202324   Academic year         National    E92000001      England
#> 2       202324   Academic year         National    E92000001      England
#> 3       202324   Academic year         National    E92000001      England
#> 4       202324   Academic year         National    E92000001      England
#> 5       202223   Academic year         National    E92000001      England
#> 6       202223   Academic year         National    E92000001      England
#> 7       202223   Academic year         National    E92000001      England
#> 8       202223   Academic year         National    E92000001      England
#> 9       202122   Academic year         National    E92000001      England
#> 10      202122   Academic year         National    E92000001      England
#>    establishment_type count_enrolments count_possible_sessions
#> 1               Total          7243517               992097450
#> 2   Secondary schools          3279477               443688893
#> 3     Primary schools          3828263               529786753
#> 4     Special schools           135777                18621804
#> 5               Total          7205803               953596210
#> 6   Secondary schools          3231224               422658822
#> 7     Primary schools          3846307               513933802
#> 8     Special schools           128272                17003586
#> 9               Total          7124944               961010417
#> 10  Secondary schools          3155929               419078718
#>    count_absent_sessions
#> 1               66345877
#> 2               36159390
#> 3               27819920
#> 4                2366567
#> 5               71792641
#> 6               37165959
#> 7               32350550
#> 8                2276132
#> 9               66300402
#> 10              34188065

# Get 2 rows
preview_dataset(example_id("dataset"), n_max = 2)
#>   time_period time_identifier geographic_level country_code country_name
#> 1      202324   Academic year         National    E92000001      England
#> 2      202324   Academic year         National    E92000001      England
#>   establishment_type count_enrolments count_possible_sessions
#> 1              Total          7243517               992097450
#> 2  Secondary schools          3279477               443688893
#>   count_absent_sessions
#> 1              66345877
#> 2              36159390

# Get all rows
preview_dataset(example_id("dataset"), n_max = Inf)
#>    time_period time_identifier geographic_level country_code country_name
#> 1       202324   Academic year         National    E92000001      England
#> 2       202324   Academic year         National    E92000001      England
#> 3       202324   Academic year         National    E92000001      England
#> 4       202324   Academic year         National    E92000001      England
#> 5       202223   Academic year         National    E92000001      England
#> 6       202223   Academic year         National    E92000001      England
#> 7       202223   Academic year         National    E92000001      England
#> 8       202223   Academic year         National    E92000001      England
#> 9       202122   Academic year         National    E92000001      England
#> 10      202122   Academic year         National    E92000001      England
#> 11      202122   Academic year         National    E92000001      England
#> 12      202122   Academic year         National    E92000001      England
#>    establishment_type count_enrolments count_possible_sessions
#> 1               Total          7243517               992097450
#> 2   Secondary schools          3279477               443688893
#> 3     Primary schools          3828263               529786753
#> 4     Special schools           135777                18621804
#> 5               Total          7205803               953596210
#> 6   Secondary schools          3231224               422658822
#> 7     Primary schools          3846307               513933802
#> 8     Special schools           128272                17003586
#> 9               Total          7124944               961010417
#> 10  Secondary schools          3155929               419078718
#> 11    Primary schools          3847780               525570085
#> 12    Special schools           121235                16361614
#>    count_absent_sessions
#> 1               66345877
#> 2               36159390
#> 3               27819920
#> 4                2366567
#> 5               71792641
#> 6               37165959
#> 7               32350550
#> 8                2276132
#> 9               66300402
#> 10              34188065
#> 11              30023935
#> 12               2088402