Update data and plots.

This commit is contained in:
mattbk
2024-10-02 19:01:29 -05:00
parent 9127b43f27
commit 82c93e6689
16 changed files with 2693 additions and 2 deletions

View File

@ -322,3 +322,29 @@ ggplot(data = ae7q_actions,
guides(color = "none")
ggsave("plots/actions-over-time.png", width = 6, height = 4)
##### Actions Over Time, last two years #####
ggplot(data = ae7q_actions %>% filter(date >= Sys.Date() - years(2)),
aes(x = date,
y = count,
color = action)) +
geom_line() +
geom_line(data = ae7q_actions %>% filter(date >= Sys.Date() - years(2)),
aes(x = date,
y = mean_30),
color = "black") +
scale_x_date(date_breaks = "3 months",
date_minor_breaks = "1 months",
date_labels = "%Y-%m") +
facet_wrap(~action,
scales = "free_y") +
theme_bw() +
labs(title = paste0("US Amateur License Actions since ", Sys.Date() - years(2)),
subtitle = "with 30-day rolling mean",
y = "Count",
x = "Date",
caption = "w1cdn.net; source: ae7q.com",
color = "Action") +
guides(color = "none")
ggsave("plots/actions-over-time-2-years.png", width = 6, height = 4)

View File

@ -167,6 +167,7 @@ ae7q_table_state <- ae7q_table_state_raw %>%
###### AE7Q License Actions ######
ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", Sys.Date())
#ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=2024-10-01")
# Read the page
ae7q_new_raw <- read_html(ae7q_new_url)
@ -193,8 +194,7 @@ ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=",
ae7q_sum01 <- ae7q_table_new %>%
#mutate(across(everything(), ~na_if(., "\""))) %>%
mutate(across(everything(),
~ case_when(. == "\"" ~ NA,
TRUE ~ .))) %>%
~replace(., . == "\"", NA))) %>%
fill(everything()) %>%
group_by(`Action Type`) %>%
summarize(count = n(), .groups = "keep") %>%