Scrape HamCall as well as ARRL.
This commit is contained in:
		@@ -4,7 +4,7 @@ library(dplyr)
 | 
				
			|||||||
library(tidyr)
 | 
					library(tidyr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# sudo crontab -e
 | 
					# 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"
 | 
					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,
 | 
					#           row.names = F,
 | 
				
			||||||
#           na = "")
 | 
					#           na = "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###### HamCall
 | 
					###### HamCall ###### 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hamcall_url <- "https://hamcall.net/hamcallcounts.html"
 | 
					hamcall_url <- "https://hamcall.net/hamcallcounts.html"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -92,8 +92,32 @@ hamcall_table_class_pivot <- hamcall_table_class_raw %>%
 | 
				
			|||||||
                                   source_name = "HamCall",
 | 
					                                   source_name = "HamCall",
 | 
				
			||||||
                                   source_detail = hamcall_url)
 | 
					                                   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 = ",", 
 | 
					write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",", 
 | 
				
			||||||
            append = TRUE, quote = FALSE, 
 | 
					            append = TRUE, quote = FALSE, 
 | 
				
			||||||
            col.names = F, row.names = FALSE,
 | 
					            col.names = F, row.names = FALSE,
 | 
				
			||||||
            na = "") 
 | 
					            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 = "") 
 | 
				
			||||||
		Reference in New Issue
	
	Block a user