Skip to content

Commit aab10f1

Browse files
committed
docs: fetch_args_list its own page, various minor
1 parent 65a3736 commit aab10f1

File tree

4 files changed

+49
-96
lines changed

4 files changed

+49
-96
lines changed

R/epidatacall.R

+32-23
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,33 @@
33
#' @aliases epidata_call
44
#'
55
#' @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.
1011
#'
1112
#' `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.
1416
#'
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)
1820
#'
1921
#' @examples
2022
#' \dontrun{
21-
#' covidcast(
23+
#' call <- covidcast(
2224
#' source = "jhu-csse",
2325
#' signals = "confirmed_7dav_incidence_prop",
2426
#' time_type = "day",
2527
#' geo_type = "state",
2628
#' 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)
2831
#' )
32+
#' call %>% fetch()
2933
#' }
3034
#'
3135
#' @param endpoint the epidata endpoint to call
@@ -98,28 +102,33 @@ print.epidata_call <- function(x, ...) {
98102
))
99103
}
100104

101-
#' Fetch args
102-
#' @rdname epidata_call
105+
#' Customize fetch settings
106+
#' @rdname fetch_args_list
103107
#' @aliases fetch_args
104108
#'
105109
#' A constructor for `fetch_args` objects, which are used to pass arguments to
106110
#' the `fetch` function.
107111
#'
108112
#' @param fields a list of epidata fields to return, or NULL to return all
109113
#' 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`
113117
#' @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/"`
118126
#' @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`
121130
#' @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"`
123132
#' @return
124133
#' - For `fetch_args_list`: a `fetch_args` object
125134
#' @export

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ epicall <- covidcast(
1818
geo_values = "us",
1919
time_values = epirange(20210405, 20210410)
2020
)
21-
epicall %>% fetch()
2221
```
2322

2423
```
2524
# A tibble: 6 × 15
2625
geo_value signal source geo_type time_type time_value
27-
<chr> <chr> <chr> <fct> <fct> <date>
26+
<chr> <chr> <chr> <fct> <fct> <date>
2827
1 us smoothed_cli fb-surv… nation day 2021-04-05
2928
2 us smoothed_cli fb-surv… nation day 2021-04-06
3029
3 us smoothed_cli fb-surv… nation day 2021-04-07
@@ -64,8 +63,7 @@ will read by default.
6463
Note that for the time being, the private endpoints (i.e. those prefixed with
6564
`pvt`) will require a separate key that needs to be passed as an argument.
6665

67-
6866
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
6967
[mit-url]: https://opensource.org/licenses/MIT
7068
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
71-
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions
69+
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions

_pkgdown.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ reference:
1818
desc: Query Delphi Epidata endpoints
1919
- contents:
2020
- epidata_call
21+
- fetch_args_list
2122
- covid_hosp_facility
2223
- covid_hosp_facility_lookup
2324
- covid_hosp_state_timeseries

man/epidata_call.Rd

+14-69
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)