sgapi
Aid Querying 'nomis' and 'Office for National Statistics Open Geography' APIs
Description
Facilitates extraction of geospatial data from the 'Office for National Statistics Open Geography' and 'nomis' Application Programming Interfaces (APIs). Simplifies process of querying 'nomis' datasets <https://www.nomisweb.co.uk/> and extracting desired datasets in dataframe format. Extracts area shapefiles at chosen resolution from 'Office for National Statistics Open Geography' <https://geoportal.statistics.gov.uk/>.
Downloads
232
Last 30 days
18916th
548
Last 90 days
2.6K
Last year
Trend: +71.9% (30d vs prior 30d)
9
Last 30 days
24
Last 90 days
131
Last year
Trend: -40% (30d vs prior 30d)
1
Last 7 days
6
Last 30 days
0
All-time
autoCRAN-only: this name is served only by autoCRAN, so the count is exact.
CRAN Check Status
Show all 13 flavors
| Flavor | Status |
|---|---|
| r-devel-linux-x86_64-debian-clang | OK |
| r-devel-linux-x86_64-debian-gcc | OK |
| r-devel-linux-x86_64-fedora-clang | OK |
| r-devel-linux-x86_64-fedora-gcc | OK |
| r-devel-windows-x86_64 | OK |
| r-oldrel-macos-arm64 | OK |
| r-oldrel-macos-x86_64 | OK |
| r-oldrel-windows-x86_64 | OK |
| r-patched-linux-x86_64 | OK |
| r-release-linux-x86_64 | OK |
| r-release-macos-arm64 | ERROR |
| r-release-macos-x86_64 | ERROR |
| r-release-windows-x86_64 | OK |
Check details (2 non-OK)
tests
Running ‘testthat.R’ [3s/147s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(sgapi)
>
> test_check("sgapi")
Reading layer `OGRGeoJSON' from data source
`https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/MSOA_Dec_2011_Boundaries_Generalised_Clipped_BGC_EW_V3_2022/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&geometryPrecision=3&f=geojson&geometry=-1.282825%2C52.354169%2C0.206626%2C52.7106&geometryType=esriGeometryEnvelope&inSR=4326&spatialRel=esriSpatialRelIntersects'
using driver `GeoJSON'
Simple feature collection with 191 features and 11 fields
...[truncated]...
, sep = sep, quote = quote, dec = dec, nmax = nrows, skip = 0, na.strings = na.strings, quiet = TRUE, fill = fill, strip.white = strip.white, blank.lines.skip = blank.lines.skip, multi.line = FALSE, comment.char = comment.char, allowEscapes = allowEscapes, flush = flush, encoding = encoding, skipNul = skipNul)`: cannot read from connection
Backtrace:
▆
1. ├─testthat::expect_warning(get_ons_table("nm_105_1", time = "latest")) at test-get_ons_table.R:6:3
2. │ └─testthat:::expect_condition_matching_(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─sgapi::get_ons_table("nm_105_1", time = "latest")
8. └─utils (local) csv_parser_fnc(nomis_conn)
9. └─utils::read.table(...)
10. └─base::scan(...)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 63 ]
Error:
! Test failures.
Execution halted
tests
Running ‘testthat.R’ [6s/168s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(sgapi)
>
> test_check("sgapi")
Reading layer `OGRGeoJSON' from data source
`https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/MSOA_Dec_2011_Boundaries_Generalised_Clipped_BGC_EW_V3_2022/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&geometryPrecision=3&f=geojson&geometry=-1.282825%2C52.354169%2C0.206626%2C52.7106&geometryType=esriGeometryEnvelope&inSR=4326&spatialRel=esriSpatialRelIntersects'
using driver `GeoJSON'
Simple feature collection with 191 features and 11 fields
...[truncated]...
EOGRAPHY_NAME, C_AGE_NAME
dbl (1): OBS_VALUE
i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
No encoding supplied: defaulting to UTF-8.
Rows: 3750 Columns: 3
-- Column specification --------------------------------------------------------
Delimiter: ","
chr (2): GEOGRAPHY_NAME, C_AGE_NAME
dbl (1): OBS_VALUE
i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 63 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-get_table.R:10:3'): Valid query returning over 25,000 rows sends a warning ──
Expected `get_table("NM_105_1", options = list(time = "latest"))` to throw a warning.
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 63 ]
Error:
! Test failures.
Execution halted
Check History
ERROR 11 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Apr 27, 2026
tests
Running ‘testthat.R’ [3s/147s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional
...[truncated]...
t_ons_table("nm_105_1", time = "latest")
8. └─utils (local) csv_parser_fnc(nomis_conn)
9. └─utils::read.table(...)
10. └─base::scan(...)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 63 ]
Error:
! Test failures.
Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Apr 23, 2026
ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Apr 16, 2026
tests
Running ‘testthat.R’ [10s/108s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional ...[truncated]... open the connection to 'https://www.nomisweb.co.uk/api/v01/dataset/nm_1002_1.data.csv?geography=TYPE265&time=latest&select=GEOGRAPHY_NAME,C_AGE_NAME,OBS_VALUE' [ FAIL 1 | WARN 1 | SKIP 0 | PASS 63 ] Error: ! Test failures. Execution halted