Open rabutler-usbr opened 4 years ago
source("R/create_sys_cond_table.R")
library(tidyverse)
sys_in <- "C:/alan/CRSS/CRSS.2020/results/apr2020/tables/Apr2020-DNF_SysTableFull_2019_2060.csv"
dcp_in <- "C:/alan/CRSS/CRSS.2020/results/apr2020/tables/Apr2020-DNF_dcp_probs_2019_2060.csv"
start_year <- 2021
out_name <- "Full"
out_dir <- "C:/alan/CRSS/CRSS.2020/results/apr2020/tables/"
# IG System Conditions ------------------------------
zz <- read.csv(
sys_in,
check.names = FALSE,
stringsAsFactors = FALSE
)
# rename the first column to Variable
cc <- colnames(zz)
cc[1] <- "Variable"
colnames(zz) <- cc
zz <- zz %>%
trim_sys_table(start_year = start_year) %>%
update_variables()
# DCP tiers ------------------------------------------
dcp <- read.csv(
dcp_in,
check.names = FALSE,
stringsAsFactors = FALSE
) %>%
trim_sys_table(start_year = start_year)
# UB table -------------------------------------------
ub <- bind_rows(zz, dcp) %>%
filter(Variable %in% ub_rows()) %>%
arrange(match(Variable, ub_rows()))
# LB table -------------------------------------------
lb <- bind_rows(zz, dcp) %>%
filter(Variable %in% lb_rows()) %>%
arrange(match(Variable, lb_rows()))
# write out -----------
write.csv(ub, file.path(out_dir, paste0(out_name, "_UB.csv")))
write.csv(lb, file.path(out_dir, paste0(out_name, "_LB.csv")))
Take the code from crss-reports and then move it here, so that the csv files are exactly what is needed for the website and the pdf tables.