Skip to contents

Returns data for the time series chart for specified metric ID and area ID. Contains an array of two areas in Areas, one of which is the National data with the other corresponding to the provided area ID. TargetValue is also returned in the Data dictionary.

Usage

cvd_indicator_metric_timeseries(metric_id = 1, area_id = 50)

Arguments

metric_id

integer - the metric to return data for (compulsory)

area_id

integer - the area to return data for (compulsory)

Value

Tibble of time-series data for the specified metric in the area

Details

CVD Prevent API documentation: Indicator time series metrics

Examples

# List data for Salford South East PCN (area ID 705) for 'AF: treatment with
# anticoagulants' for women people aged 60-79 years (metric ID 130):
cvd_indicator_metric_timeseries(metric_id = 130, area_id = 705) |>
  dplyr::select(AreaName, TimePeriodName, TimePeriodID, Value) |>
  tidyr::pivot_wider(
    names_from = AreaName,
    values_from = Value
  )
#> # A tibble: 11 × 4
#>    TimePeriodName    TimePeriodID England `Salford South East PCN`
#>    <chr>                    <int>   <dbl>                    <dbl>
#>  1 To March 2020                1    88.2                     85.9
#>  2 To March 2021                2    88.6                     86  
#>  3 To September 2021            3    88.9                     88.8
#>  4 To March 2022                4    89.3                     90  
#>  5 To June 2022                 5    89.4                     90.2
#>  6 To September 2022            6    89.6                     90.6
#>  7 To December 2022             7    90.0                     91.7
#>  8 To March 2023                8    91.0                     90.1
#>  9 To June 2023                 9    91.0                     91.0
#> 10 To December 2023            15    91.2                     92.2
#> 11 To March 2024               17    92.2                     93.9