state_pct_change: pct_change_state: Create a map of states based upon the...

View source: R/arima-spike-multigeo.R

state_pct_changeR Documentation

pct_change_state: Create a map of states based upon the percentage increase in searches before or after the interruption

Description

pct_change_state: Create a map of states based upon the percentage increase in searches before or after the interruption

Usage

state_pct_change(
  df,
  interrupt,
  beginperiod = NA,
  preperiod = NA,
  endperiod = NA,
  scaletitle = "Pct. Increase\nin Searches",
  scalelimits = NULL,
  linecol = "gray",
  lowcol = NA,
  midcol = NULL,
  highcol = NA,
  colorscheme = "red",
  save = T,
  width = 6,
  height = 4,
  bootstrap = T,
  outfn = "./output/fig.png",
  bootnum = 1000,
  alpha = 0.05,
  return_df = T
)

Arguments

df

A dataframe including time as timestamp and searches for your given geography in one column.

interrupt

The date where things change. ARIMA will be predicted on all days before the interrupt.

beginperiod

How far back you want the "pre" period to go

preperiod

This creates a beginperiod but with a number of days instead of a date

endperiod

How far after the interruption you want to go

scaletitle

Title of the scale

scalelimits

vector of two values for min and max for the scale

linecol

Line color

lowcol

Color for low values

midcol

Color for mid values

highcol

Color for high values

save

Default is True, If False, don't save

width

Width of file in inches

height

Height of file in inches

outfn

Output filename

Examples

pct_change_state(
  df = read.csv("./temp/data.csv", header = T, stringsAsFactor = F),
  interrupt = "2020-03-01",
  beginperiod = NA,
  preperiod = 90,
  endperiod = "2020-03-23",
  scaletitle = "Pct. Increase in Searches",
  linecol = "gray",
  lowcol = "red",
  midcol = "white",
  highcol = "dodgerblue4"
)

tlcaputi/gtrendR documentation built on Nov. 3, 2022, 10:46 p.m.