This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "next": null, | |
| "previous": null, | |
| "results": [ | |
| { | |
| "id": 1234, | |
| "uuid": "esn4dk", | |
| "flow": { | |
| "uuid": "whsj5ei", | |
| "name": "weeklyratings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Visualizing OWID plot as slope chart | |
| # @ericpgreen | |
| # original: https://ourworldindata.org/does-the-news-reflect-what-we-die-from?linkId=68864855 | |
| library(tidyverse) | |
| library(ggrepel) | |
| library(viridis) | |
| #library(RColorBrewer) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # @ericpgreen | |
| # CausalImpact | |
| library(CausalImpact) | |
| set.seed(1) | |
| x1 <- 24 + arima.sim(model = list(ar = 0.999), n = 24) | |
| y <- 1.2 * x1 + rnorm(24) | |
| y[13:24] <- y[13:24] + 10 | |
| data <- cbind(y, x1) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| points<- structure(list(Id = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, | |
| 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zones <- structure(list(Id = c(0L, 0L, 0L, 0L), LocationID = c(10, 20, | |
| 30, 40), geometry = structure(list(structure(list(structure(c(34.0801799264875, | |
| 34.080295586826, 34.0804625363008, 34.080629560025, 34.0805268621977, | |
| 34.0805269199715, 34.0806296631948, 34.0806682414381, 34.0806426051738, | |
| 34.0806940056932, 34.0809252151302, 34.0810793258357, 34.0812462918301, | |
| 34.0813233079207, 34.0812847379028, 34.0814003074831, 34.0815801246098, | |
| 34.0816828223496, 34.081657070448, 34.0816955495712, 34.0819138540295, | |
| 34.0821835548344, 34.0822606493965, 34.0824661687807, 34.0826460147848, | |
| 34.0827102954327, 34.0826589776298, 34.0826847337602, 34.0828131916925, | |
| 34.0829416579086, 34.0830059220743, 34.083121487434, 34.0832755980364, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dat <- structure(list(as_areaK2 = c(1.80600428124798, 0.540755162151071, | |
| 1.11380561798778, 0.905008535194981, 1.51030279174279, 1.62818277069323, | |
| 0.547670625847753, 0.423004007838352, 1.46253516403771, 0.356614193846387, | |
| 1.32537997345858, 1.97943199845685, 0.704586252581037, 5.43783602151111, | |
| 0.295972731390631, 0.569928566697037, 2.00102994158912, 0.536332014583354, | |
| 1.09615798927973, 0.614294565789438, 1.43053345446891, 0.290749391275211, | |
| 0.835675266761967, 1.769093703832, 0.168990657300447, 1.24986815028974, | |
| 1.13883574377182, 0.168090567405105, 0.817897846292054, 0.401271690522274, | |
| 0.290621172764002, 0.712438998211716, 0.783548316264122, 0.650124767482093, | |
| 0.0797067856323663, 0.806036492389197, 0.117758252729661, 0.402213489166873, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(modeldata) | |
| data("stackoverflow") | |
| library(tidyverse) | |
| library(tidymodels) | |
| set.seed(100) # Important! | |
| # make smaller to save time | |
| so_split <- initial_split(sample_n(stackoverflow, size = 300), | |
| strata = Remote) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df_mi <- structure(list(v1 = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, | |
| 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, | |
| 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, | |
| 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, | |
| 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, | |
| 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, | |
| 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, | |
| 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, | |
| 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 91L, 92L, 93L, | |
| 94L, 95L, 96L, 97L, 98L, 99L, 100L, 41L, 42L, 43L, 44L, 45L, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df_plot <- structure(list(Country.Region = structure(c(10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, | |
| 10L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, | |
| 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, | |
| 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(countrycode) # install.packages("countrycode") | |
| # get the data | |
| cases_wide <- read.csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv", stringsAsFactors = FALSE) | |
| # pivot longer | |
| cases <- | |
| cases_wide %>% | |
| # sum subnational data to get national totals |