Description Usage Arguments Value Examples
Computes the percentage change of the values in a covidcast_signal
data
frame. (When multiple issue dates are present, only the latest issue is
considered.) See the percentage change vignette
for examples.
1 | pct_change(x, n = 14, col_name = "pct_change")
|
x |
The |
n |
Size of the local window (in days) to use (bumped up to the nearest
even integer, if needed). For example, if |
col_name |
String indicating the name of the new column that will
contain the percentage change values. Default is "pct_change"; note that we
can set |
A data frame given by appending a new column to x
named according
to the col_name
argument, containing the percentage change values.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
df <- covidcast::covidcast_signal("fb-survey", "smoothed_cli",
start_day = "2021-01-01",
end_day = "2021-01-31",
geo_type = "state")
# percentage change between back-to-back weeks (default, as n = 14)
pct_change(df)
# percentage change between back-to-back days
pct_change(df, n = 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.