Crawls the PXWeb API to rebuild the table index. If path is provided,
the index is written to that file; otherwise only the in-memory index is
refreshed.
Usage
nso_rebuild_px_index(
path = NULL,
write = !is.null(path),
allow_incomplete = FALSE
)Arguments
- path
Output path for JSON. If
NULL(default), no file is written. For package development, use"inst/extdata/px_index.json". A companion<path>.metadata.jsonfile preserves coverage and build time, checked against the index's SHA-256 hash and service identity on reload.- write
Whether to write JSON to
path. Defaults toTRUEifpathis provided,FALSEotherwise.- allow_incomplete
Allow a partial crawl to replace the current index and be written to disk. Defaults to
FALSE; incomplete crawls raise a typed error and leave the previous index and output file intact.
Value
A tibble containing the rebuilt table index. If some catalogue
requests fail, the index is built from the rest and a warning of class
mongolstats_incomplete_index names the failed paths.
Examples
# Crawls the entire PXWeb catalogue; takes several minutes
if (FALSE) { # \dontrun{
idx <- nso_rebuild_px_index()
head(idx)
} # }