Description Usage Arguments Value Examples
ts_format
takes a line list of case data and formats it into weekly
or daily time series, which can be used to fit a seasonal baseline.
1 2 3 4 5 6 7 8 9 10 11 |
line.list |
A dataframe containing one line for each case (e.g., ED
visit, hospitalization). At a minimum, each row should have the date of
the visit ( |
datevar |
A string. What variable contains the date? |
statevar |
A string. What variable contains the 2-digit state code
(e.g., |
sub.statevar |
A string. What variable contains the local geography identifier? (e.g., county, borough) |
agevar |
A string. What variable contains the age group? Use 'none' if there is no age grouping in the data |
covs |
A character vector. Which, if any, variables in |
syndromes |
A character vector. Which variables contain counts of
syndromic data? (e.g., |
resolution |
One of |
remove.final |
A logical scalar. Remove the final date in the dataset? This is someties helpful if the data from the last date is unfinalized or otherwise untrustworthy. |
A dataframe in the "long" format, with a row for each time period (as in, week or day), and location (e.g. state, county), and age category. There is a column for date, age category, location, and the number of counts for each of the selected syndromes. There is also a column that tallies all visits, regardless of cause
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | n.obs <- 10000
set.seed(42)
simulated_data <-
as.data.frame(matrix(NA, nrow=n.obs, ncol=5))
names(simulated_data) <- c('state','date','agegrp','ili','resp')
simulated_data$state<- c( rep('CT', times=n.obs*0.3),
rep("NY", times=n.obs*0.7) )
simulated_data$agegrp <- sample(1:5, n.obs, replace=T)
simulated_data$date <-
sample(seq.Date(from=as.Date('2019-01-01'), by='day', length.out=500),
1000,
replace=T)
simulated_data$ili <- rbinom(n=n.obs, size=1, prob=0.05)
simulated_data$resp <- rbinom(n=n.obs, size=1, prob=0.1)
ts1 <- ts_format(line.list=simulated_data,
datevar='date',
agevar='agegrp',
statevar='state',
syndromes=c('ili','resp'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.