Skip to content

Instantly share code, notes, and snippets.

@dspm
Created May 17, 2020 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dspm/4a4cc5236c3f925406c81d071621d514 to your computer and use it in GitHub Desktop.
Save dspm/4a4cc5236c3f925406c81d071621d514 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(jsonlite)
set.seed(666)
data <-
"https://www.koronavirus.hr/json/?action=po_osobama" %>%
fromJSON() %>%
as_tibble() %>%
transmute(report = as.Date(Datum)) %>%
mutate(
test_delay = rgamma(n(), 2, 2),
exam_delay = rgamma(n(), 3, 2),
onset_delay = rgamma(n(), 3, .4),
infection_delay = rlnorm(n(), log(6), log(1.5)),
total_delay = infection_delay + onset_delay + exam_delay + test_delay,
infection = report - floor(total_delay)
) %>%
select(report, infection, total_delay, everything())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment