Last active
January 12, 2022 14:02
-
-
Save martinmodrak/0391feb2a62448de5ec38690381f293f to your computer and use it in GitHub Desktop.
This file contains 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(lubridate) | |
quakes_raw <- read_csv("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv") | |
quakes <- quakes_raw %>% mutate(hour = floor_date(time, "hour"), | |
day = floor_date(time, "day")) | |
quake_fanos <- quakes %>% group_by(hour, day, net) %>% | |
summarise(count = n()) %>% | |
group_by(day, net) %>% | |
summarise(fano = var(count) / mean(count)) %>% | |
filter(!is.na(fano)) | |
max_fano <- max(quake_fanos$fano) | |
quake_fanos %>% | |
ggplot(aes(x = fano)) + geom_histogram(breaks = seq(0, max_fano, by = 0.5)) + | |
geom_vline(xintercept = 1, color = "blue", size = 1) + | |
facet_wrap(~net) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment