Update recent data as available and fix some code to work with newer version of R.
This commit is contained in:
+15
-6
@@ -9,26 +9,33 @@ library(htmlwidgets)
|
||||
library(lubridate)
|
||||
library(ggrepel)
|
||||
library(zoo)
|
||||
library(readr)
|
||||
|
||||
#### Total/State/Class ####
|
||||
# Read in total/state/class data
|
||||
d_raw <- read.csv("data/us ham radio licenses over time.csv")
|
||||
d_raw <- read_csv("data/us ham radio licenses over time.csv")
|
||||
|
||||
# What dates do we have?
|
||||
unique(d_raw$Date)
|
||||
|
||||
# Clean up here if needed
|
||||
d <- d_raw %>%
|
||||
mutate(Date = as.Date(Date)) #%>%
|
||||
mutate(Date = as.Date(Date)) %>%
|
||||
rename("State.Territory" = "State/Territory")
|
||||
# Drop Tech alone and leave Tech and Tech Plus
|
||||
#select(-c(Tech, Tech.Plus))
|
||||
|
||||
d_total <- d %>% filter(State.Territory == "TOTAL")
|
||||
d_total <- d %>% filter(State.Territory == "TOTAL") # |>
|
||||
# Make sure blank cells are actually NAs
|
||||
# mutate(across(everything(), gsub, pattern = "^$", replacement = NA_integer_),
|
||||
# Date = as.Date(Date))
|
||||
|
||||
d_total_long <- d_total %>%
|
||||
pivot_longer(cols = !c("Date", "State.Territory", "source_name", "source_detail"),
|
||||
names_to = "lclass",
|
||||
values_to = "count") %>%
|
||||
mutate(count = as.numeric(count),
|
||||
Date = as.Date(Date)) %>%
|
||||
# only keep rows with data so plots look right
|
||||
filter(!is.na(count))
|
||||
|
||||
@@ -59,10 +66,12 @@ qst_raw <- read.csv("data/qst-somc.csv")
|
||||
arrl <- arrl_raw %>%
|
||||
mutate(Date = as.Date(Date))
|
||||
qst <- qst_raw %>%
|
||||
group_by(form_month, source) %>%
|
||||
mutate(Date = as.Date(form_month),
|
||||
paid_copies_mean_monthly = c15_year_copies_paid +
|
||||
a16_year_copies_digital_paid) %>%
|
||||
pivot_longer(cols = -c(form_month, Date))
|
||||
paid_copies_mean_monthly = sum(c15_year_copies_paid,
|
||||
a16_year_copies_digital_paid,
|
||||
na.rm = T)) %>%
|
||||
pivot_longer(cols = -c(form_month, Date, source))
|
||||
|
||||
#### Plots ####
|
||||
|
||||
|
||||
Reference in New Issue
Block a user