Scrape HamCall as well as ARRL.

This commit is contained in:
mattbk 2024-04-21 20:43:37 -05:00
parent cd7b11c16b
commit 35bff3b7a2

View File

@ -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 = "")