Replication data are available in SQL and Rdata at https://github.com/judgelord/rulemaking
load(here("data", "OIRAandUA.Rdata") %>% str_replace("dissertation", "rulemaking"))
#FIXME MOVE
# consolidate ORIA and UA DATES
#class(regs$DATE_RECEIVED)
regs %<>%
mutate(UnifiedAgendaDate = coalesce(UnifiedAgendaDate, as.Date(DATE_RECEIVED)),
WithdrawalPublished = WITHDRAWAL %>% as.Date(format = "%Y-%m-%d"))
#sum(is.na(regs$UnifiedAgendaDate))
# select one observation per RIN
regs$Year <- str_sub(regs$UnifiedAgendaDate, 1,4) %>% as.numeric()
regs %<>% mutate(Stage = case_when(
str_detect(STAGE, "Final Rule|Completed") ~ "Final Rule",
str_detect(STAGE, "Withdrawal|Terminat") ~ "Withdrawal",
str_detect(STAGE, "Pre|Prop") ~ "Proposed"
))
regs %<>% drop_na(Stage)
regs %<>% distinct(UnifiedAgendaDate,RIN, AGENCY, PARENT_AGENCY, RIN, Stage, Year)
regs %<>%
ungroup() %>%
dplyr::group_by(RIN, Year) %>%
dplyr::top_n(n = 1, UnifiedAgendaDate) %>%
dplyr::ungroup() %>%
distinct()
# FIXME will need to add date back in for other plots
regs %<>% distinct(Year,RIN, AGENCY, PARENT_AGENCY, RIN, Stage, Year)
regs %<>% mutate(policy_code =
case_when(
str_detect(RIN, "^21") ~ "Transportation",
str_detect(RIN, "^05") ~ "Agriculture",
str_detect(RIN, "^06|^15") ~ "Commerce & Treasury",
str_detect(RIN, "^07") ~ "Defense",
str_detect(RIN, "^18") ~ "Education",
str_detect(RIN, "^19") ~ "Energy",
str_detect(RIN, "^20") ~ "Environmental",
str_detect(RIN, "^23") ~ "Government Operations",
str_detect(RIN, "^14|10070|^35100|^0625") ~ "Foreign Policy",
str_detect(RIN, "^12") ~ "Labor",
str_detect(RIN, "^10|^0596") ~ "Public Lands",
str_detect(RIN, "^16|^0938") ~ "Welfare",
str_detect(RIN, "^11") ~ "Justice",
str_detect(RIN, "^0507|^2529|^35000") ~ "Civil Rights"
))
# regs %>% count(policy_code)
regs %<>% mutate(policy_type = case_when(
policy_code %in% c("Education",
"Health",
"Labor",
"Justice",
"Welfare",
"Civil Rights") ~ "Social Policy",
policy_code %in% c("Transportation",
"Agriculture",
"Commerce",
"Energy",
"Lands") ~ "Economic Policy",
policy_code %in% c("Environmental") ~ "Environmental Policy",
policy_code %in% c("Defense", "Foreign Policy") ~ "Foreign Policy"
))
ua <- regs
save(ua, file = here("data","ua.Rdata"))
## REGULATIONS.GOV
load(here("data", "rules_metadata.Rdata"))
rules %<>% filter(document_type %in% c("Proposed Rule", "Rule"),
# rulemaking dockets only
docket_type == "Rulemaking" ) %>%
# one document per docket (drop additional PRs )
group_by(document_type, docket_id) %>%
slice_max(number_of_comments_received)
rules %<>%
mutate(comment_start_date = comment_start_date %>% as.Date(),
comment_due_date = comment_due_date %>% as.Date(),
date = coalesce(posted_date, comment_start_date, comment_due_date),
year = str_sub(date, 1,4),
year2 = str_remove(docket_id, ".*[A-Z]-") %>%
str_remove("-.*"),
year = coalesce(year, year2) %>% as.numeric()
) %>%
dplyr::select(-year2)
rules %<>% filter(year >2004)# ej-data-documenttype
# document type over time
rules %>%
ggplot() +
aes(x = year, fill = document_type) +
geom_bar(alpha = .7) +
labs(y = "Number of Documents",
x = "",
fill = "") +
scale_fill_viridis_d(option="cividis", begin = .1, end = .7, direction = -1, ) +
theme(axis.text.x = element_text(angle = 45,
hjust = 1, vjust = .5),
panel.grid.major.x = element_blank(),
panel.border = element_blank())
party_control <- read_csv(here("data", "1-20.csv"))
party_control %<>%
mutate(Seats = as.numeric(Seats),
congress = as.numeric(Congress)) %>%
pivot_wider(id_cols = c("congress", "Chamber"), names_from = PartyStatus, values_from = Seats)
party_control %<>%
mutate(party_control = case_when(
Democrat > Republican ~ "Democrat",
Republican > Democrat ~ "Republican"
))
party_control %<>%
pivot_wider(id_cols = congress, names_from = Chamber, values_from = party_control)
party_control$President <- NA
# president's party
party_control %<>%
mutate(President = case_when(
# Carter elected with the 95th
congress >94 & congress < 97 ~ "Democrat",
# Regan elected with the 97th
congress > 96 & congress < 101 ~ "Republican",
# BUSH elected with the 101st
congress > 100 & congress < 103 ~ "Republican",
# CLINTON elected with 103th
congress >102 & congress < 107 ~ "Democrat",
# Bush elected with 107th
congress >106 & congress < 111 ~ "Republican",
# OBAMA elected with 111th
congress >110 & congress < 115 ~ "Democrat",
# TRUMP elected with 115th
congress > 114 & congress <117 ~ "Republican",
# BIDEN
congress > 116 ~ "Democrat"))
party_control %<>% mutate(Senate = ifelse(is.na(Senate), President, Senate))
congress_years<- function(congress){
years<- c(congress*2 + 1787, congress*2 + 1788 )
return(years)
}
party_control %<>%
pivot_longer(cols = c("House", "Senate", "President")) %>%
group_by(congress) %>%
mutate(year = congress %>% congress_years %>% unique() %>% list()) %>%
unnest(year)
party_control %<>% rename(Party = value)
party_control %<>%
filter(year %in% regs$Year) %>%
mutate(name = name %>% str_replace("Sen", " Sen"))
breaks = seq( 1980, max(ua$Year), by = 2)
tile <- party_control %>%
ggplot() +
aes(x = year, y = name, fill = Party) +
geom_tile(color = "white") +
scale_fill_viridis_d(option = "plasma", end = .6) +
labs(y = "", x = "", fill = "") +
scale_x_continuous(breaks = breaks) +
theme_minimal() +
theme(panel.grid = element_blank()) +
theme(axis.text.x = element_text(angle = 45,
hjust = 1#, vjust = 1
))
tile
# functions to plot
macro_scatterplot <- function(policy){
ua %>%
filter(policy_code == policy) %>%
ggplot() +
aes(y=RIN) +
labs(title = paste(unique(policy), 'Rulemaking'),
y = "RIN",
x = "Year")+
#geom_linerange(aes(ymin=initiated, ymax=enddate, color="black"), size=.1) +
geom_point(aes(x=UnifiedAgendaDate, color="black"), shape = 15, size=1) +
geom_point(aes(x=WithdrawalPublished, color="red"), shape = 4, size=.5) +
scale_x_date(lim = c(as.Date("1981-08-11"), as.Date("2016-06-01")),
breaks=date_breaks(width = "2 year"), labels = date_format("%y"),
minor_breaks=NULL)+
scale_color_identity("",guide="legend",
labels=c("Rule Published",
"Rule Withdrawn")) +
theme(axis.text.x =
element_text(size =2,
angle = 90,
hjust = 1,
vjust = .5)) #+ facet_wrap("AGENCY", scales = "free_y")
}
# UA ALL BY STATUS
#ua %<>% mutate(Status = ifelse(Stage == "Withdrawal"|!str_detect(WITHDRAWAL, "-"), "Published", "Withdrawn"))
p <- ua %>%
count(Year, Stage) %>%
ggplot() +
aes(x = as.integer(Year), y = n, fill = Stage) +
geom_col(alpha = .6) +
labs(#title = paste('"Significant"', unique(policy), 'Rulemaking Projects'),
x = "",
y = "Number of Rules") +
theme(panel.border = element_blank(),
axis.text.x =
element_text(#size =2,
angle = 45,
hjust = 1)) +#, vjust = .5)) +
scale_x_continuous(breaks = breaks) +
scale_fill_viridis_d(option = "cividis", end = 1, direction = -1)
library(cowplot)
plot_grid(p, tile, align = "v", nrow = 2, rel_heights = c(2.5,1))
# UA ALL BY AGENCY
p <- ua %>%
mutate(Agency = str_remove_all(PARENT_AGENCY, "Department of |the |^[0-9]*|[A-Z]*$")) %>%
mutate(Agency = Agency %>% replace_na(" Other")) %>%
count(Year, Agency) %>%
ggplot() +
aes(x = as.integer(Year), y = n, fill = Agency) +
geom_col(alpha = .6) +
labs(#title = paste('"Significant"', unique(policy), 'Rulemaking Projects'),
x = "",
y = "Number of Rules") +
theme(panel.border = element_blank(),
axis.text.x =
element_text(#size =2,
angle = 45,
hjust = 1)) +#, vjust = .5)) +
scale_x_continuous(breaks = breaks) +scale_fill_viridis_d()
p
ua %<>% mutate(PARENT_AGENCY = coalesce(PARENT_AGENCY, AGENCY))
# PLOT BY POLICY CODE
macro_hist <- function(policy){
x <- ua %>%
filter(policy_code == policy)
p <- x %>%
count(Year, Stage) %>%
ggplot() +
aes(x = as.integer(Year), y = n, fill = Stage) +
geom_col(alpha = .6) +
labs(#title = paste(unique(policy), 'Rulemaking'),
subtitle = paste0(#"(",
paste(x$PARENT_AGENCY %>%
unique() %>% purrr::discard(is.na) %>% str_remove_all("^[0-9]*|[A-Z]*$"), collapse = " and ")#,")"
),
x = "",
y = "Number of Rules") +
scale_x_continuous(breaks = breaks) +
#theme_minimal() +
theme(panel.border = element_blank(),
axis.text.x = element_text(angle = 45,
hjust = 1)) +
scale_fill_viridis_d(option = "cividis", end = .9, direction = -1)
#p
library(cowplot)
plot_grid(p, tile, align = "v", nrow = 2, rel_heights = c(2,1))
}
macro_hist2 <- function(policy){
breaks = seq( 1980, max(ua$Year), by = 2)
x <- ua %>%
filter(policy_type == policy)
p <- x %>%
count(Year, Stage) %>%
ggplot() +
aes(x = as.integer(Year), y = n, fill = Stage) +
geom_col(alpha = .6) +
labs(title = paste(unique(policy), 'Rulemaking'),
x = "",
y = "Number of Rules") +
scale_x_continuous(breaks = breaks) +
#theme_minimal() +
theme(panel.border = element_blank(),
axis.text.x = element_text(angle = 45,
hjust = 1)) +
scale_fill_viridis_d(option = "cividis", end = .9, direction = -1)
#p
library(cowplot)
plot_grid(p, tile, align = "v", nrow = 2, rel_heights = c(2,1))
}
macro_table <- function(policy){
x <- ua %>%
filter(policy_code == policy | policy_type == policy)
caption <- x$PARENT_AGENCY %>%
unique() %>%
str_remove_all("^[0-9]*|[A-Z]*$") %>%
as_tibble() %>%
drop_na(value) %>% pull(value) %>% str_c(collapse = ", ") %>% str_c(policy, ., sep = ":\n")
x$AGENCY %>%
unique() %>%
as_tibble() %>%
drop_na(value) %>%
rename(`Includes` = value) %>%
kable3(caption = caption)
}
policy <- "Economic Policy"
macro_hist2(policy)
macro_table(policy)| Includes |
|---|
| Office of the SecretaryAg |
| Office of Chief Financial Officer |
| Office of the General Counsel |
| Agricultural Research Service |
| Cooperative State Research, Education, and Extension Service |
| National Institute of Food and Agriculture |
| National Agricultural Statistical Service |
| Foreign Agricultural Service |
| Farm Service Agency |
| Federal Crop Insurance Corporation |
| Rural Business-Cooperative Service |
| Rural Utilities Service |
| Rural Housing Service |
| Natural Resources Conservation Service |
| Animal and Plant Health Inspection Service |
| Grain Inspection, Packers and Stockyards Administration |
| Agricultural Marketing Service |
| Food Safety and Inspection Service |
| Food and Nutrition Service |
| Forest Service |
| Office of Procurement and Property Management |
| Office of Contracting and Procurement |
| Departmental and Others |
| Federal Energy Regulatory Commission |
| Economic Regulatory Administration |
| Energy Efficiency and Renewable Energy |
| Office of Administration |
| Office of General Counsel |
| Office of Procurement and Assistance Management |
| Office of Procurement and Assistance Policy |
| Acquisition and Project Management |
| Office of Acquisition Management |
| Defense and Security Affairs |
| National Nuclear Security Agency |
| National Nuclear Security Administration |
| Office of the Secretary |
| Transportation Security Administration |
| U.S. Coast Guard |
| Federal Aviation Administration |
| Federal Highway Administration |
| Federal Motor Carrier Safety Administration |
| National Highway Traffic Safety Administration |
| Federal Railroad Administration |
| Federal Transit Administration |
| Maritime Administration |
| Saint Lawrence Seaway Development Corporation |
| Research and Special Programs Administration |
| Pipeline and Hazardous Materials Safety Administration |
| Bureau of Transportation Statistics |
| Research and Innovative Technologies Administration |
| Surface Transportation Board |
policy <- "Social Policy"
macro_hist2(policy)
macro_table(policy)| Includes |
|---|
| Centers for Medicare & Medicaid Services |
| General Administration |
| United States Parole Commission |
| Legal Activities |
| Federal Bureau of Investigation |
| Immigration and Naturalization Service |
| Drug Enforcement Administration |
| Bureau of Prisons |
| Office of Justice Programs |
| Executive Office for Immigration Review |
| Bureau of Alcohol, Tobacco, Firearms, and Explosives |
| Civil Rights Division |
| Employment and Training Administration |
| Employee Benefits Security Administration |
| Pension Benefit Guaranty Corporation |
| Employment Standards Administration |
| Occupational Safety and Health Administration |
| Mine Safety and Health Administration |
| Wage and Hour Division |
| Office of Workers’ Compensation Program |
| Office of Workers’ Compensation Programs |
| Office of Labor-Management Standards |
| Office of Labor-Managment Standards |
| Office of Federal Contract Compliance Programs |
| Office of the Secretary |
| Office of the Assistant Secretary for Administration and Management |
| Office of the Assistant Secretary for Veterans’ Employment and Training |
| Office of the American Workplace |
| U.S. Citizenship and Immigration Services |
| Bureau of Citizenship and Immigration Services |
| U.S. Coast Guard |
| Directorate of Border and Transportation Security |
| U.S. Customs and Border Protection |
| Bureau of Customs and Border Protection |
| Transportation Security Administration |
| Bureau of Immigration and Customs Enforcement |
| U.S. Immigration and Customs Enforcement |
| Federal Emergency Management Agency |
| Directorate of Emergency Preparedness and ResponseEP& |
| Directorate of Emergency Preparedness and Response/FEMAEP& |
| Cybersecurity and Infrastructure Security Agency |
| Office of the Undersecretary for Management |
| Office of the General Counsel |
| Office of Elementary and Secondary Education |
| Office of Special Education and Rehabilitative Services |
| Office of Vocational and Adult Education |
| Office of Career, Technical, and Adult Education |
| Office of Postsecondary Education |
| Office of Federal Student Aid |
| Institute of Education Sciences |
| Office of Innovation and Improvement |
| Office of Intergovernmental and Interagency Affairs |
| Office of Safe and Drug-Free Schools |
| Office for Civil Rights |
| Office of Planning, Evaluation and Policy Development |
| Office of Management |
| Office of English Language Acquistion |
| Office of the Chief Financial Officer |
| Office of the Under Secretary |
| Office of Fair Housing and Equal Opportunity |
policy <- "Foreign Policy"
macro_hist(policy)
macro_hist2(policy)
macro_table(policy)| Includes |
|---|
| Department of the Air Force |
| Department of the Army |
| Department of the Navy |
| U.S. Army Corps of Engineers |
| Office of Assistant Secretary for Health Affairs |
| Defense Acquisition Regulations Council |
| Office of the Secretary |
| Department of State |
policy <- "Transportation"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Office of the Secretary |
| Transportation Security Administration |
| U.S. Coast Guard |
| Federal Aviation Administration |
| Federal Highway Administration |
| Federal Motor Carrier Safety Administration |
| National Highway Traffic Safety Administration |
| Federal Railroad Administration |
| Federal Transit Administration |
| Maritime Administration |
| Saint Lawrence Seaway Development Corporation |
| Research and Special Programs Administration |
| Pipeline and Hazardous Materials Safety Administration |
| Bureau of Transportation Statistics |
| Research and Innovative Technologies Administration |
| Surface Transportation Board |
policy <- "Agriculture"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Office of the SecretaryAg |
| Office of Chief Financial Officer |
| Office of the General Counsel |
| Agricultural Research Service |
| Cooperative State Research, Education, and Extension Service |
| National Institute of Food and Agriculture |
| National Agricultural Statistical Service |
| Foreign Agricultural Service |
| Farm Service Agency |
| Federal Crop Insurance Corporation |
| Rural Business-Cooperative Service |
| Rural Utilities Service |
| Rural Housing Service |
| Natural Resources Conservation Service |
| Animal and Plant Health Inspection Service |
| Grain Inspection, Packers and Stockyards Administration |
| Agricultural Marketing Service |
| Food Safety and Inspection Service |
| Food and Nutrition Service |
| Forest Service |
| Office of Procurement and Property Management |
| Office of Contracting and Procurement |
policy <- "Commerce & Treasury"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| General Administration |
| Bureau of the Census |
| Economic Development Administration |
| International Trade Administration |
| National Oceanic and Atmospheric Administration |
| Patent and Trademark Office |
| National Telecommunications and Information Administration |
| Office of the Secretary |
| Bureau of Economic Analysis |
| Technology Administration |
| National Technical Information Service |
| National Institute of Standards and Technology |
| Bureau of Industry and Security |
| Departmental Offices |
| Financial Crimes Enforcement Network |
| Financial Management Service |
| Bureau of Alcohol, Tobacco and Firearms |
| Alcohol and Tobacco Tax and Trade Bureau |
| United States Customs Service |
| Customs Revenue Function |
| Bureau of the Fiscal Service |
| Bureau of the Public Debt |
| Internal Revenue Service |
| Office of Thrift Supervision |
| Comptroller of the Currency |
| Community Development Financial Institutions Fund |
policy <- "Defense"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Department of the Air Force |
| Department of the Army |
| Department of the Navy |
| U.S. Army Corps of Engineers |
| Office of Assistant Secretary for Health Affairs |
| Defense Acquisition Regulations Council |
| Office of the Secretary |
policy <- "Welfare"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Centers for Medicare & Medicaid Services |
| Office of the Secretary |
| U.S. Citizenship and Immigration Services |
| Bureau of Citizenship and Immigration Services |
| U.S. Coast Guard |
| Directorate of Border and Transportation Security |
| U.S. Customs and Border Protection |
| Bureau of Customs and Border Protection |
| Transportation Security Administration |
| Bureau of Immigration and Customs Enforcement |
| U.S. Immigration and Customs Enforcement |
| Federal Emergency Management Agency |
| Directorate of Emergency Preparedness and ResponseEP& |
| Directorate of Emergency Preparedness and Response/FEMAEP& |
| Cybersecurity and Infrastructure Security Agency |
| Office of the Undersecretary for Management |
policy <- "Public Lands"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Bureau of Land Management |
| Bureau of Reclamation |
| Minerals Management Service |
| Bureau of Ocean Energy Management, Regulation, and Enforcement |
| Bureau of Ocean Energy Management |
| Office of Natural Resources Revenue |
| Bureau of Safety and Environmental Enforcement |
| United States Fish and Wildlife Service |
| National Park Service |
| Geological Survey |
| Office of Surface Mining Reclamation and Enforcement |
| Office of the Special Trustee |
| Bureau of Indian Affairs |
| Assistant Secretary for Land and Minerals Management |
| Assistant Secretary for Policy, Management and Budget |
| Office for Equal Opportunity |
| Office of the Solicitor |
| Office of the Secretary |
| Office of Hearings and Appeals |
policy <- "Justice"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| General Administration |
| United States Parole Commission |
| Legal Activities |
| Federal Bureau of Investigation |
| Immigration and Naturalization Service |
| Drug Enforcement Administration |
| Bureau of Prisons |
| Office of Justice Programs |
| Executive Office for Immigration Review |
| Bureau of Alcohol, Tobacco, Firearms, and Explosives |
| Civil Rights Division |
policy <- "Labor"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Employment and Training Administration |
| Employee Benefits Security Administration |
| Pension Benefit Guaranty Corporation |
| Employment Standards Administration |
| Occupational Safety and Health Administration |
| Mine Safety and Health Administration |
| Wage and Hour Division |
| Office of Workers’ Compensation Program |
| Office of Workers’ Compensation Programs |
| Office of Labor-Management Standards |
| Office of Labor-Managment Standards |
| Office of Federal Contract Compliance Programs |
| Office of the Secretary |
| Office of the Assistant Secretary for Administration and Management |
| Office of the Assistant Secretary for Veterans’ Employment and Training |
| Office of the American Workplace |
policy <- "Education"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Office of the General Counsel |
| Office of Elementary and Secondary Education |
| Office of Special Education and Rehabilitative Services |
| Office of Vocational and Adult Education |
| Office of Career, Technical, and Adult Education |
| Office of Postsecondary Education |
| Office of Federal Student Aid |
| Institute of Education Sciences |
| Office of Innovation and Improvement |
| Office of Intergovernmental and Interagency Affairs |
| Office of Safe and Drug-Free Schools |
| Office for Civil Rights |
| Office of Planning, Evaluation and Policy Development |
| Office of Management |
| Office of English Language Acquistion |
| Office of the Chief Financial Officer |
| Office of the Secretary |
| Office of the Under Secretary |
policy <- "Energy"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Departmental and Others |
| Federal Energy Regulatory Commission |
| Economic Regulatory Administration |
| Energy Efficiency and Renewable Energy |
| Office of Administration |
| Office of General Counsel |
| Office of Procurement and Assistance Management |
| Office of Procurement and Assistance Policy |
| Acquisition and Project Management |
| Office of Acquisition Management |
| Defense and Security Affairs |
| National Nuclear Security Agency |
| National Nuclear Security Administration |
policy <- "Civil Rights"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Office of Fair Housing and Equal Opportunity |
policy <- "Environmental"
macro_hist(policy)
macro_table(policy)| Includes |
|---|
| Regional Office Boston |
| Regional Office New York |
| Regional Office Philadelphia |
| Regional Office Atlanta |
| Regional Office Chicago |
| Regional Office Dallas |
| Regional Office Denver |
| Regional Office San Francisco |
| Office of Policy |
| Regional Office Seattle |
| Office of General Counsel |
| Office of Enforcement and Compliance Assurance |
| Office of Environmental Information |
| Administration and Resources Management |
| Office of Mission Support |
| Water |
| Office of Water |
| Solid Waste and Emergency Response |
| Office of Land and Emergency Management |
| Air and Radiation |
| Office of Air and Radiation |
| Office of Prevention, Pesticides and Toxic Substances |
| Office of Chemical Safety and Pollution Prevention |
| Office of Research and Development |
| Office of the AdministratorAdm |
count(regs, Stage) ## # A tibble: 3 × 2
## Stage n
## <chr> <int>
## 1 Final Rule 51305
## 2 Proposed 30688
## 3 Withdrawal 6127
count(regs, RIN,sort = T) ## # A tibble: 61,971 × 2
## RIN n
## <chr> <int>
## 1 0905-AA06 12
## 2 3116-AA01 12
## 3 0579-AA36 11
## 4 0575-AA14 10
## 5 0625-AA06 10
## 6 0905-AD08 9
## 7 0563-AA18 8
## 8 0563-AA30 8
## 9 0563-AA33 8
## 10 0563-AA52 8
## # … with 61,961 more rows
count(regs, RIN, Stage, sort = T) ## # A tibble: 82,983 × 3
## RIN Stage n
## <chr> <chr> <int>
## 1 0575-AA14 Final Rule 10
## 2 0579-AA36 Final Rule 8
## 3 1018-AA24 Final Rule 8
## 4 0563-AA33 Final Rule 7
## 5 0905-AA06 Final Rule 7
## 6 3116-AA01 Final Rule 7
## 7 0551-AA06 Final Rule 6
## 8 0563-AA04 Final Rule 6
## 9 0563-AA05 Final Rule 6
## 10 0563-AA07 Final Rule 6
## # … with 82,973 more rows