|
3 | 3 | #' @aliases epidata_call
|
4 | 4 | #'
|
5 | 5 | #' @description
|
6 |
| -#' `epidata_call` objects are generated by endpoint functions like |
7 |
| -#' [`covidcast`]; should be piped into the `fetch` function to fetch and format |
8 |
| -#' the data. For most endpoints this will return a tibble, but a few |
9 |
| -#' non-COVIDCAST endpoints only support will return a JSON-like list instead. |
| 6 | +#' `epidata_call` objects are generated internally by endpoint functions like |
| 7 | +#' [`covidcast`]; by default, they are piped directly into the `fetch` |
| 8 | +#' function to fetch and format the data. For most endpoints this will return |
| 9 | +#' a tibble, but a few non-COVIDCAST endpoints only support will return a |
| 10 | +#' JSON-like list instead. |
10 | 11 | #'
|
11 | 12 | #' `create_epidata_call` is the constructor for `epidata_call` objects, but you
|
12 |
| -#' should not need to use it directly; instead, use an endpoint function, e.g., |
13 |
| -#' [`covidcast`], to generate an `epidata_call` for the data of interest. |
| 13 | +#' should not need to use it directly; instead, use an endpoint function, |
| 14 | +#' e.g., [`covidcast`], to generate an `epidata_call` for the data of |
| 15 | +#' interest. |
14 | 16 | #'
|
15 |
| -#' There are some other functions available for debugging and advanced usage: |
16 |
| -#' - `request_url` (for debugging): outputs the request URL from which data |
17 |
| -#' would be fetched (note additional parameters below) |
| 17 | +#' There are some other functions available for debugging and advanced usage: - |
| 18 | +#' `request_url` (for debugging): outputs the request URL from which data |
| 19 | +#' would be fetched (note additional parameters below) |
18 | 20 | #'
|
19 | 21 | #' @examples
|
20 | 22 | #' \dontrun{
|
21 |
| -#' covidcast( |
| 23 | +#' call <- covidcast( |
22 | 24 | #' source = "jhu-csse",
|
23 | 25 | #' signals = "confirmed_7dav_incidence_prop",
|
24 | 26 | #' time_type = "day",
|
25 | 27 | #' geo_type = "state",
|
26 | 28 | #' time_values = epirange(20200601, 20200801),
|
27 |
| -#' geo_values = c("ca", "fl") |
| 29 | +#' geo_values = c("ca", "fl"), |
| 30 | +#' fetch_args = fetch_args_list(make_call = FALSE) |
28 | 31 | #' )
|
| 32 | +#' call %>% fetch() |
29 | 33 | #' }
|
30 | 34 | #'
|
31 | 35 | #' @param endpoint the epidata endpoint to call
|
@@ -98,28 +102,33 @@ print.epidata_call <- function(x, ...) {
|
98 | 102 | ))
|
99 | 103 | }
|
100 | 104 |
|
101 |
| -#' Fetch args |
102 |
| -#' @rdname epidata_call |
| 105 | +#' Customize fetch settings |
| 106 | +#' @rdname fetch_args_list |
103 | 107 | #' @aliases fetch_args
|
104 | 108 | #'
|
105 | 109 | #' A constructor for `fetch_args` objects, which are used to pass arguments to
|
106 | 110 | #' the `fetch` function.
|
107 | 111 | #'
|
108 | 112 | #' @param fields a list of epidata fields to return, or NULL to return all
|
109 | 113 | #' fields (default) e.g. c("time_value", "value") to return only the
|
110 |
| -#' time_value and value fields or c("-direction") to return everything except |
111 |
| -#' the direction field |
112 |
| -#' @param disable_date_parsing disable automatic date parsing |
| 114 | +#' time_value and value fields or c("-direction") to return everything except |
| 115 | +#' the direction field |
| 116 | +#' @param disable_date_parsing disable automatic date parsing; by default `FALSE` |
113 | 117 | #' @param disable_data_frame_parsing disable automatic conversion to data frame; this
|
114 |
| -#' is only supported by endpoints that only support the 'classic' format (non-tabular) |
115 |
| -#' @param return_empty boolean that allows returning an empty tibble if there is no data |
116 |
| -#' @param timeout_seconds the maximum amount of time to wait for a response |
117 |
| -#' @param base_url base URL to use |
| 118 | +#' is only supported by endpoints that only support the 'classic' format (non-tabular). |
| 119 | +#' by default `FALSE` |
| 120 | +#' @param return_empty boolean that allows returning an empty tibble if there is no data; |
| 121 | +#' by default `FALSE` |
| 122 | +#' @param timeout_seconds the maximum amount of time to wait for a response; by default |
| 123 | +#' `FALSE` |
| 124 | +#' @param base_url base URL to use; by default `NULL`, which means the global base url |
| 125 | +#' `"https://api.delphi.cmu.edu/epidata/"` |
118 | 126 | #' @param make_call boolean that allows skipping the call to the API and instead
|
119 |
| -#' returns the `epidata_call` object (useful for debugging) |
120 |
| -#' @param debug boolean that allows returning the raw response from the API |
| 127 | +#' returns the `epidata_call` object (useful for debugging); by default `TRUE` |
| 128 | +#' @param debug boolean that allows returning the raw response from the API; by default |
| 129 | +#' `FALSE` |
121 | 130 | #' @param format_type the format to request from the API, one of classic, json, csv; this
|
122 |
| -#' is only used by `fetch_debug` |
| 131 | +#' is only used by `fetch_debug`, and by default is `"json"` |
123 | 132 | #' @return
|
124 | 133 | #' - For `fetch_args_list`: a `fetch_args` object
|
125 | 134 | #' @export
|
|
0 commit comments