Improve HamCall states scraper and add to database.

This commit is contained in:
Matt 2024-09-18 16:12:11 +00:00
parent 3865b24190
commit bd856dd399
2 changed files with 4462 additions and 16 deletions

View File

@ -105,6 +105,27 @@ hamcall_table_state <- hamcall_table_state_raw %>%
source_detail = hamcall_url) %>%
relocate(date, State, Count, source_name, source_detail)
# https://stackoverflow.com/questions/5411979/state-name-to-abbreviation
state_codes <- tibble(state = state.name) %>%
bind_cols(tibble(code = state.abb)) %>%
bind_rows(tibble(state = "District of Columbia", code = "DC")) %>%
bind_rows(tibble(state = "Armed Forces America", code = "AA")) %>%
bind_rows(tibble(state = "American Samoa", code = "AS")) %>%
bind_rows(tibble(state = "Armed Forces Pacific", code = "AP")) %>%
bind_rows(tibble(state = "Armed Forces Europe", code = "AE")) %>%
bind_rows(tibble(state = "Virgin Islands", code = "VI")) %>%
bind_rows(tibble(state = "Guam", code = "GU")) %>%
bind_rows(tibble(state = "Northern Mariana Islands", code = "MP")) %>%
bind_rows(tibble(state = "Puerto Rico", code = "PR"))
hamcall_table_state <- left_join(hamcall_table_state, state_codes, by = join_by(State == code), keep = F) %>%
mutate(a=NA, b=NA, c=NA, d=NA, e=NA, f=NA,
g=NA, h=NA, i=NA, j=NA, k=NA, l=NA, m=NA) %>%
select(-State) %>%
relocate(state, .after = date) %>%
relocate(Count, .after = f) %>%
relocate(source_name:source_detail, .after = m)
###### AE7Q ######
ae7q_url <- "https://www.ae7q.com/query/stat/LicenseUSA.php"

File diff suppressed because it is too large Load Diff