| cihiget | R Documentation |
Resolves a CIHI table from the bundled catalogue and downloads it to
dest, falling back to the Internet Archive snapshot if the live
CIHI URL has rotated or been removed. The download + fallback runs
through rmoriebricklayer's shared C++/libcurl foundation
(blfetch()), the same engine rmorie and
morie use – one implementation across the ecosystem.
cihiget(which, dest = NULL, timeout = 120L)
which |
A row index into |
dest |
Destination file path. Default: a tempfile with the table's own extension. |
timeout |
Per-request timeout, seconds. |
The dest path, invisibly. Errors if both the live URL
and its Wayback fallback fail.
# Offline: inspect the catalogue to choose a `which` argument.
cat <- cihitbls()
head(cat$title, 3)
# Downloads a table from the live CIHI web service; try() keeps the
# example graceful when the service is unreachable.
# `which` by title substring (case-insensitive; must match exactly one).
f1 <- try(cihiget("Hospital Beds, 2024")) # -> tempfile path
# `which` by row index into cihitbls(); `dest` chooses the
# output path and `timeout` bounds each request (seconds).
f3 <- try(cihiget(1,
dest = tempfile(fileext = ".xlsx"),
timeout = 60
))
# An ambiguous substring errors and lists the candidates:
try(cihiget("data"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.