as.covidcast_signal {covidcast} | R Documentation |
Convert data from an external source into a form compatible with
covidcast_signal
.
Description
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.
Usage
as.covidcast_signal(x, ...)
## S3 method for class 'covidcast_signal'
as.covidcast_signal(x, ...)
## S3 method for class 'data.frame'
as.covidcast_signal(
x,
signal = NULL,
geo_type = c("county", "msa", "hrr", "dma", "state", "hhs", "nation"),
time_type = c("day", "week"),
data_source = "user",
issue = NULL,
metadata = list(),
...
)
Arguments
x |
Object to be converted. See Methods section below for details on formatting of each input type. |
... |
Additional arguments passed to methods. |
signal |
The signal name to use for this data. |
geo_type |
The geography type stored in this object. |
time_type |
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. |
data_source |
The name of the data source to use as a label for this data. |
issue |
Issue date to use for this data, if not present in |
metadata |
List of metadata to attach to the |
Value
covidcast_signal
object; see covidcast_signal()
for documentation
of fields and structure.
Methods (by class)
-
as.covidcast_signal(covidcast_signal)
: Simply returns thecovidcast_signal
object unchanged. -
as.covidcast_signal(data.frame)
: The input data framex
must contain the columnstime_value
,value
, andgeo_value
. If anissue
column is present inx
, it will be used as the issue date for each observation; if not, theissue
argument will be used. Other columns will be preserved as-is.