"0","# cannot use read_csv for reading in these files because of parsing error on some of the EOL transport dropbox values"
"0","decon <- read.csv(""intermediary/final_deconstruction_scenario_with_transport.csv"", stringsAsFactors = F)"
"0","demo <- read.csv(""intermediary/final_demolition_scenario_with_transport.csv"", stringsAsFactors = F)"
"0","worker_equipment_impacts <- read.csv(""intermediary/per_project_worker_equipment_transport_impacts.csv"", stringsAsFactors = F)"
"0","house_weight <- read.csv(""intermediary/house_weight.csv"", stringsAsFactors = F)"
"0","house_weight$project <- as.character(house_weight$project)"
"0","house_weight$contractor <- as.character(house_weight$contractor)"
"0","# standardize impact_units"
"0","decon$impact_units <- str_replace(decon$impact_units, ""kgCO2e"", ""kg CO2e"")"
"0","# clear index columns and add the activity scenario name"
"0","decon <- decon[,-1] %>%"
"0","   add_column(scenario = ""decon"", .before = 1)"
"0","demo <- demo[,-1] %>%"
"0","   add_column(scenario = ""demo"", .before = 1)"
"0","# adjust worker_equipment_impacts to fit the structure of the decon and demo activity scenario data frames"
"0","worker_equipment_impacts <- worker_equipment_impacts %>%"
"0","   add_column(decon_equipment = 0, .before = 7) %>%"
"0","   add_column(SimpleEOLname = ""per_project_transport"") %>%"
"0","   add_column(disposition = ""none"") %>%"
"0","   add_column(quantity = 1) %>%"
"0","   add_column(quantity_units = ""per_project"") %>%"
"0","   add_column(material_impacts = 0) %>%"
"0","   add_column(EOL_transport_impact = 0) %>%"
"0","   gather(`decon_workers`, `decon_equipment`, `demo_workers`, `demo_equipment`, key = ""scenario_deconMaterialName"", value = ""site_transport_impact"") %>%"
"0","   separate(scenario_deconMaterialName, into = c(""scenario"", ""deconMaterialName""), sep = ""_"") %>%"
"0","   select(c(""scenario"", ""house_age"", ""house_size"", ""project"", ""contractor"", ""deconMaterialName"", ""SimpleEOLname"", ""disposition"", ""quantity"", ""quantity_units"", ""material_impacts"",""site_transport_impact"", ""EOL_transport_impact"", ""impact_units""))"
"0","# join all 3 data frames to create a master data set that contains all material and transport impacts from both scenarios and save it"
"0","final_complete_data <- bind_rows(decon, demo, worker_equipment_impacts)"
"0","final_complete_data$project <- as.character(final_complete_data$project)"
"0","final_complete_data$contractor <- as.character(final_complete_data$contractor)"
"0","write.csv(final_complete_data, ""intermediary/final_complete_data_all_scenario_impacts.csv"")"
"0","# in some instances, it may be desirable to see material impacts of either just the Softwood lumber products, or everything else minus the Softwood lumber products"
"0","softwood_lumber <- final_complete_data %>%"
"0","   filter(deconMaterialName == ""softwood lumber"")"
"0","nonSoftwood_lumber <- anti_join(final_complete_data, softwood_lumber, by = c(""scenario"", ""house_age"", ""house_size"", ""project"", ""contractor"", ""deconMaterialName"", ""SimpleEOLname"", ""disposition"", ""quantity"", ""quantity_units"", ""material_impacts"", ""site_transport_impact"", ""EOL_transport_impact"", ""impact_units""))"
"0","# remove comment to write/save these two tables separately as needed"
"0","# write.csv(softwood_lumber, ""intermediary/softwood lumber data.csv"")"
"0","# write.csv(nonSoftwood_lumber, ""intermediary/nonSoftwood lumber data.csv"")"
