as.covidcast_signal: Convert data from an external source into a form compatible...

View source: R/covidcast.R

as.covidcast_signalR Documentation

Convert data from an external source into a form compatible with covidcast_signal.


Several methods are provided to convert common objects (such as data frames) into covidcast_signal objects, which can be used with the various covidcast_signal methods (such as plot.covidcast_signal() or covidcast_cor()). See vignette("external-data") for examples.


as.covidcast_signal(x, ...)

## S3 method for class 'covidcast_signal'
as.covidcast_signal(x, ...)

## S3 method for class 'data.frame'
  signal = NULL,
  geo_type = c("county", "msa", "hrr", "dma", "state", "hhs", "nation"),
  time_type = c("day", "week"),
  data_source = "user",
  issue = NULL,
  metadata = list(),



Object to be converted. See Methods section below for details on formatting of each input type.


Additional arguments passed to methods.


The signal name to use for this data.


The geography type stored in this object.


The time resolution stored in this object. If "day", the default, each observation covers one day. If "week", each time value is assumed to be the start date of the epiweek (MMWR week) that the data represents.


The name of the data source to use as a label for this data.


Issue date to use for this data, if not present in x, as a Date object. If no issue date is present in x and issue is NULL, today's date will be used.


List of metadata to attach to the covidcast_signal object. See the "Metadata" section of covidcast_signal(). All objects will have geo_type, data_source, and signal columns included in their metadata; named entries in this list are added as additional columns.


covidcast_signal object; see covidcast_signal() for documentation of fields and structure.

Methods (by class)

  • as.covidcast_signal(covidcast_signal): Simply returns the covidcast_signal object unchanged.

  • as.covidcast_signal(data.frame): The input data frame x must contain the columns time_value, value, and geo_value. If an issue column is present in x, it will be used as the issue date for each observation; if not, the issue argument will be used. Other columns will be preserved as-is.

See Also


covidcast documentation built on Oct. 7, 2022, 1:06 a.m.