Description Usage Arguments Value Examples
This function loops across all hospital IDs and runs get_wait_times
in order to extract all wait times
1 2 3 | get_wait_times_all(output_format = c("json", "data_frame"),
request_headers = "", data_type = c("emergency", "consultation",
"surgery"), sleep_time = 1)
|
output_format |
defines the format of the final output resulting form the API call. Two options:
(1) |
request_headers |
named character vector with the HTTP headers to be added to |
data_type |
Character string determining the type of data to request. Can be either (1) |
sleep_time |
Integer defining the number of seconds to wait between API calls. Strongly recomend setting a sleeper time so as to not overloading the server. Defaults to 3 seconds. |
list with json strings or tibble. The relevant wait times for "emergency"
are in both seconds as integer or ymd_hms
. For "consultation"
or "surgery"
they unit of analysis is day as integer. All datasets also contain a variable measuring wait times by the number of people waiting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(esperaR)
## Not run:
library(ggplot2)
## extract emergency data as a data frame
wait_dta <- get_wait_times_all(output_format = "data_frame", data_type = "consultation")
wait_dta %>%
group_by(priority) %>%
summarise(mean_wait_time = mean(as.integer(days), na.rm = TRUE)) %>%
ungroup() %>%
top_n(mean_wait_time, 10) %>%
ggplot(aes(priority, mean_wait_time)) +
geom_boxplot() +
coord_flip()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.