diff --git a/bin/scrape-license-counts.R b/bin/scrape-license-counts.R index 5cb4441..9f55a0b 100644 --- a/bin/scrape-license-counts.R +++ b/bin/scrape-license-counts.R @@ -8,6 +8,7 @@ library(tidyr) ###### ARRL ###### arrl_url <- "https://www.arrl.org/fcc-license-counts" +cat("Checking ARRL...") # Read the page d_raw <- read_html(arrl_url) @@ -51,6 +52,7 @@ write.table(tab, file = "out/arrl-fcc-licenses-scraped.csv", sep = ",", ###### HamCall ###### hamcall_url <- "https://hamcall.net/hamcallcounts.html" +cat("Checking HamCall...") # Read the page hamcall_raw <- read_html(hamcall_url) @@ -127,9 +129,26 @@ hamcall_table_state <- left_join(hamcall_table_state, state_codes, by = join_by( relocate(Count, .after = f) %>% relocate(source_name:source_detail, .after = m) +##### Append tables ##### +write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",", + append = TRUE, quote = FALSE, + col.names = F, row.names = FALSE, + na = "") + +write.table(hamcall_table_city, file = "out/hamcall-cities-scraped.csv", sep = ",", + append = TRUE, quote = FALSE, + col.names = F, row.names = FALSE, + na = "") + +write.table(hamcall_table_state, file = "out/hamcall-states-scraped.csv", sep = ",", + append = TRUE, quote = FALSE, + col.names = F, row.names = FALSE, + na = "") + ###### AE7Q States ###### ae7q_url <- "https://www.ae7q.com/query/stat/LicenseUSA.php" +cat("Checking AE7Q...") # Read the page ae7q_raw <- read_html(ae7q_url) @@ -168,6 +187,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()-1) #ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=2024-11-01") +cat("Checking AE7Q actions...") # Read the page ae7q_new_raw <- read_html(ae7q_new_url) @@ -211,21 +231,6 @@ ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", ##### Append tables ##### -write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",", - append = TRUE, quote = FALSE, - col.names = F, row.names = FALSE, - na = "") - -write.table(hamcall_table_city, file = "out/hamcall-cities-scraped.csv", sep = ",", - append = TRUE, quote = FALSE, - col.names = F, row.names = FALSE, - na = "") - -write.table(hamcall_table_state, file = "out/hamcall-states-scraped.csv", sep = ",", - append = TRUE, quote = FALSE, - col.names = F, row.names = FALSE, - na = "") - write.table(ae7q_table_state, file = "out/ae7q-states-scraped.csv", sep = ",", append = TRUE, quote = FALSE, col.names = F, row.names = FALSE,