Downloads data from the NHS Open Data platform using a SQL query. Similar to get_resource()
, but allows more flexible server-side querying. This function has a lower maximum row number (32,000 vs 99,999) for returned results.
get_resource_sql(sql)
A tibble with the query results. Only 32,000 rows can be returned from a single SQL query.
get_resource()
for downloading a resource without using a
SQL query.
sql <- "
SELECT
\"TotalCancelled\",\"TotalOperations\",\"Hospital\",\"Month\"
FROM
\"bcc860a4-49f4-4232-a76b-f559cf6eb885\"
WHERE
\"Hospital\" = 'D102H'
"
df <- get_resource_sql(sql)
# This is equivalent to:
cols <- c("TotalCancelled", "TotalOperations", "Hospital", "Month")
row_filter <- c(Hospital = "D102H")
df2 <- get_resource(
"bcc860a4-49f4-4232-a76b-f559cf6eb885",
col_select = cols,
row_filters = row_filter
)