Skip to content
Snippets Groups Projects
Commit f7b5c371 authored by Tom Rushby's avatar Tom Rushby
Browse files

Tidy up.

parent 08c66416
No related branches found
No related tags found
No related merge requests found
......@@ -42,35 +42,21 @@ download.file(url_to_get, tempf, method = "curl")
dt <- readxl::read_xlsx(tempf, sheet = "Full dataset",skip = 1)
# Functions (REDUNDANT) ----
# Functions ----
lvl_detail <- "high"
filter_detail <- function(lvl_detail = lvl_detail){
if(lvl_detail == "low"){
ghg_subset <- function(dt, auth_area = "Southampton"){
dt <- dt %>%
filter(Name %in% las_to_load) %>%
select(`CTRY18NM/RGN18NM`,`Second Tier Authority`,Name,
Code,Year,`Industry and Commercial Total`,
`Domestic Total`,`Transport Total`,`LULUCF Net Emissions`)
filter(dt$Name %in% auth_area)
# add filter for categories with input$
}
if(lvl_detail == "high"){
dt <- dt %>%
filter(Name %in% las_to_load) %>%
select(`CTRY18NM/RGN18NM`,`Second Tier Authority`,Name,Code,Year,
`A. Industry and Commercial Electricity`,`B. Industry and Commercial Gas`,
`C. Large Industrial Installations`,`D. Industrial and Commercial Other Fuels`,
`E. Agriculture`,
`F. Domestic Electricity`,`G. Domestic Gas`,`H. Domestic 'Other Fuels'`,
`I. Road Transport (A roads)`,`J. Road Transport (Motorways)`,`K. Road Transport (Minor roads)`,
`L. Diesel Railways`,`M. Transport Other`,
`LULUCF Net Emissions`)
}
ghg_emissions <- melt(dt, id.vars = c("CTRY18NM/RGN18NM","Second Tier Authority","Name","Code","Year"))
return(ghg_emissions)
ghg_subset2 <- function(dt, auth_area = "Southampton"){
dt <- dt %>%
filter(dt$Name %in% auth_area,
dt$Year == plot_year)
# add filter for categories with input$
}
......@@ -127,11 +113,7 @@ las_to_load <- c(las_to_load, " Hampshire (Average)") # add Hampshire average to
auth_area <- " Hampshire (Average)" # Use to set auth_area manually (outside of loop)
ghg_subset <- function(dt, auth_area = "Southampton"){
dt <- dt %>%
filter(dt$Name %in% auth_area)
# add filter for categories with input$
}
# Construct plots ----
plotCaption = paste0("Emissions data: Department for Business, Energy & Industrial Strategy",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment