Yearly Trends - Incentive Classifications

Code
knitr::opts_chunk$set(warning = FALSE, message = FALSE)

options(scipen = 999)

library(tidyverse)
library(glue)
library(sf)
library(DT)
library(flextable)

nicknames <- readxl::read_excel("../Necessary_Files/muni_shortnames.xlsx")

cook_sums <- read_csv("../Output/ptaxsim_cook_level_2006to2023_new.csv") 

muni_shp <- read_sf("../Necessary_Files/muni_shp.gpkg")


knitr::opts_chunk$set(warning = FALSE, message = FALSE)

set_flextable_defaults(theme_fun = theme_vanilla, 
                       padding = 2,
                       line_spacing = 1,
                       big.mark = ",",
                       )

options(DT.options = list())

FitFlextableToPage <- function(ft, pgwidth = 6){

  ft_out <- ft %>% autofit()

  ft_out <- width(ft_out, width = dim(ft_out)$widths*pgwidth /(flextable_dim(ft_out)$widths))
  return(ft_out)
}

# Create an empty data frame with a column named "year"
params <- data.frame(year = numeric(0))

# Add the value 2021 to the "year" column
params <- rbind(params, data.frame(year = 2023))

Export Tables

Code
library(readxl)

tablelist <- list(
  "Muni Stats" = munilevel,
  "Muni Rate Change" = muni_ratechange,
  
  "Cook Sums" = table_cook,
  "Cook Class Sums" = cty_MC_table,
  "Cook Rate Change" = cook_ratechange
)




#writexl::write_xlsx(tablelist, "Output/calculations_report_content_20240927.xlsx")

readme <- c(
  "Pin Change: Count of PINs gaining or losing an incentive class each year.",
  "Major Class Change: Counts of PINs becoming major class types each year.",
  "Top 10 Commercial Incents is based on summed FMV from properties that have commercial incentive classes.",
  "Top 10 Industrial Incents is based on summed FMV from properties that have industrial incentive classes.",
  
  "Muni Shares shows the top 5, middle 5, and bottom 5 munis based on the share of FMV that has an incentive property out of all FMV in the municipality. Note: Municipalities without commercial or industrial property are excluded from this list.",
  "Commerc_Share shows the top 5, middle 5, and bottom 5 municipalities based on share of commercial incentive FMV out of the commercial FMV within the municipality.Note: There are at least 50 municipalities that do not have commercial incentive properties. The bottom 5 displayed are alphabetically last, but there are 50 tied at 0%.",
            "Indust_Share shows the top 5, middle 5, and bottom 5 municipalities based on the share of industrial incentive FMV out of the industrial FMV within the municipality. Note: There are at least 38 municipalities that do not have industrial incentive properties. The bottom 5 displayed are alphabetically last, but there are 38 tied at 0%.",
  
  "Muni Share_all includes all municipalities and their share of FMV with incentives out of all FMV in the municipality.",
  "IndustShare_all is same as Indust_share but includes all munis.",
  "CommercShare_all is same as Commerc_share but includes all munis.") %>% as.data.frame()

paper_tables <- list(
  "README"= readme,
  
  "Pin Change per Year" = pins_per_year,
  "Top 10 Commercial Incents" = commerc_top10,
  "Top 10 Indust Incents" = indust_top10,
  
  "Muni Shares" = muni_incentshare_slice,
  "Indust_Share" = indust_share,
  "Commerc_Share" = commerc_share,

  "Muni Share_all" = muni_incent_share,
  "IndustShare_all" = indust_share_full,
  "Commerc_Share_all" = commerc_share_full,
  
  "Rate Change" = muni_ratechange_sliced
  
)

# writexl::write_xlsx(paper_tables, "../Output/incentive_report_tables.xlsx")