covidcast_signals: Obtain multiple COVIDcast signals at once

Description Usage Arguments Details Value See Also Examples

View source: R/covidcast.R

Description

This convenience function uses covidcast_signal() to obtain multiple signals, potentially from multiple data sources.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
covidcast_signals(
  data_source,
  signal,
  start_day = NULL,
  end_day = NULL,
  geo_type = c("county", "hrr", "msa", "dma", "state", "hhs", "nation"),
  geo_values = "*",
  as_of = NULL,
  issues = NULL,
  lag = NULL
)

Arguments

data_source

String identifying the data source to query. See https://cmu-delphi.github.io/delphi-epidata/api/covidcast_signals.html for a list of available data sources.

signal

String identifying the signal from that source to query. Again, see https://cmu-delphi.github.io/delphi-epidata/api/covidcast_signals.html for a list of available signals.

start_day

Query data beginning on this date. Date object, or string in the form "YYYY-MM-DD". If start_day is NULL, defaults to first day data is available for this signal.

end_day

Query data up to this date, inclusive. Date object or string in the form "YYYY-MM-DD". If end_day is NULL, defaults to the most recent day data is available for this signal.

geo_type

The geography type for which to request this data, such as "county" or "state". Defaults to "county". See https://cmu-delphi.github.io/delphi-epidata/api/covidcast_geography.html for details on which types are available.

geo_values

Which geographies to return. The default, "*", fetches all geographies. To fetch specific geographies, specify their IDs as a vector or list of strings. See https://cmu-delphi.github.io/delphi-epidata/api/covidcast_geography.html for details on how to specify these IDs.

as_of

Fetch only data that was available on or before this date, provided as a Date object or string in the form "YYYY-MM-DD". If NULL, the default, return the most recent available data. Note that only one of as_of, issues, and lag should be provided; it does not make sense to specify more than one. For more on data revisions, see "Issue dates and revisions" below.

issues

Fetch only data that was published or updated ("issued") on these dates. Provided as either a single Date object (or string in the form "YYYY-MM-DD"), indicating a single date to fetch data issued on, or a vector specifying two dates, start and end. In this case, return all data issued in this range. There may be multiple rows for each observation, indicating several updates to its value. If NULL, the default, return the most recently issued data.

lag

Integer. If, for example, lag = 3, then we fetch only data that was published or updated exactly 3 days after the date. For example, a row with time_value of June 3 will only be included in the results if its data was issued or updated on June 6. If NULL, the default, return the most recently issued data regardless of its lag.

Details

The argument structure is just as in covidcast_signal(), except the first four arguments data_source, signal, start_day, end_day are permitted to be vectors. The first two arguments data_source, 'signal are recycled appropriately, in the calls to covidcast_signal(); see example below. The next two arguments start_day, end_day, unless NULL, must be either length 1 or N.

Value

A list of covidcast_signal data frames, of length N = max(length(data_source), length(signal)). This list can be aggregated into a single data frame of either "wide" or "long" format using aggregate_signals().

See Also

covidcast_signal(), aggregate_signals()

Examples

1
2
3
4
5
6
7
## Not run: 
## Fetch USAFacts confirmed cases and deaths over the same time period
covidcast_signals("usa-facts", signal = c("confirmed_incidence_num",
                                          "deaths_incidence_num"),
                   start_day = "2020-08-15", end_day = "2020-10-01")

## End(Not run)

covidcast documentation built on May 4, 2021, 9:08 a.m.