From 35bff3b7a21b670e478aaf22faa5c2dc4ed9612a Mon Sep 17 00:00:00 2001 From: mattbk Date: Sun, 21 Apr 2024 20:43:37 -0500 Subject: [PATCH] Scrape HamCall as well as ARRL. --- ...ape-arrl-fcc.R => scrape-license-counts.R} | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) rename bin/{scrape-arrl-fcc.R => scrape-license-counts.R} (76%) diff --git a/bin/scrape-arrl-fcc.R b/bin/scrape-license-counts.R similarity index 76% rename from bin/scrape-arrl-fcc.R rename to bin/scrape-license-counts.R index 9267fa4..45cd1d6 100644 --- a/bin/scrape-arrl-fcc.R +++ b/bin/scrape-license-counts.R @@ -4,7 +4,7 @@ library(dplyr) library(tidyr) # sudo crontab -e -# 5 9 * * * su matt -c "cd /home/matt/ham-radio-licenses/; Rscript /home/matt/ham-radio-licenses/scrape-arrl-fcc.R">/dev/null 2>&1 +# 5 9 * * * su matt -c "cd /home/matt/ham-radio-licenses/; Rscript /home/matt/ham-radio-licenses/scrape-license-counts.R">/dev/null 2>&1 arrl_url <- "https://www.arrl.org/fcc-license-counts" @@ -48,7 +48,7 @@ write.table(tab, file = "out/arrl-fcc-licenses-scraped.csv", sep = ",", # row.names = F, # na = "") -###### HamCall +###### HamCall ###### hamcall_url <- "https://hamcall.net/hamcallcounts.html" @@ -92,8 +92,32 @@ hamcall_table_class_pivot <- hamcall_table_class_raw %>% source_name = "HamCall", source_detail = hamcall_url) -# Append table +# City counts +hamcall_table_city <- hamcall_table_city_raw %>% + mutate(date = hamcall_date, + source_name = "HamCall", + source_detail = hamcall_url) %>% + relocate(date) + +# State counts +hamcall_table_state <- hamcall_table_state_raw %>% + mutate(date = hamcall_date, + source_name = "HamCall", + source_detail = hamcall_url) %>% + relocate(date, State, Count, source_name, source_detail) + +# 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 = "")