Skip to content

Commit

Permalink
Add maps for all countries
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashsinghal committed Oct 8, 2024
1 parent f93b60b commit df9b87b
Show file tree
Hide file tree
Showing 15 changed files with 32,373 additions and 13 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ importFrom(tibble,tibble)
importFrom(tibble,tribble)
importFrom(tidyr,drop_na)
importFrom(tidyr,pivot_wider)
importFrom(tidyselect,all_of)
importFrom(tidyselect,matches)
importFrom(tiltIndicator,example_data_factory)
importFrom(tiltIndicatorAfter,profile_emissions)
Expand Down
2 changes: 1 addition & 1 deletion R/bar_plot_emission_profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ prepare_bar_plot_emission_profile <- function(data, grouping_emission, mode, sce
group_by(.data[[risk_category]], .data$grouping_emission) |>
summarise(total_mode = sum(.data[[mode]])) |>
group_by(.data$grouping_emission) |>
mutate(proportion = total_mode / sum(total_mode))
mutate(proportion = .data$total_mode / sum(.data$total_mode))

data
}
Expand Down
5 changes: 4 additions & 1 deletion R/bar_plot_emission_profile_financial.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#'
#' @examples
#' grouping_emission <- c("all", "unit", "isic_4digit")
#' bar_plot_emission_profile_financial(financial, grouping_emission, "equal_weight", risk_category = "emission_category")
#' bar_plot_emission_profile_financial(financial, grouping_emission,
#' "equal_weight",
#' risk_category = "emission_category"
#' )
bar_plot_emission_profile_financial <- function(data,
grouping_emission = grouping_emission(),
mode = c(
Expand Down
3 changes: 1 addition & 2 deletions R/map_region_risk.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#' map_region_risk(without_financial, country_code = "DE", benchmark = "unit")
#' })
map_region_risk <- function(data,
# TODO: plot for other countries
country_code = c("DE"),
country_code = c("DE", "AT", "FR", "NL", "ES"),
grouping_emission = grouping_emission(),
mode = modes(),
scenario = scenarios(),
Expand Down
7 changes: 3 additions & 4 deletions R/prepare_geo_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @noRd
#'
prepare_geo_data <- function(data,
country_code = c("DE"),
country_code = c("DE", "AT", "FR", "NL", "ES"),
grouping_emission = grouping_emission(),
mode = modes(),
scenario = scenarios(),
Expand Down Expand Up @@ -46,8 +46,7 @@ prepare_geo_data <- function(data,

# merge to have zip codes with NUTS file
shp_1 <- shp_1 |>
inner_join(nuts_de, by = "geo") |>
mutate(postcode = as.character(postcode))
inner_join(nuts_all, by = "geo")

# merge shapefile with financial data
geo <- data |>
Expand Down Expand Up @@ -92,7 +91,7 @@ aggregate_geo <- function(geo, mode, risk_category) {
group_by(.data$postcode, .data[[risk_category]]) |>
summarise(total_mode = sum(.data[[mode]])) |>
group_by(.data$postcode) |>
mutate(proportion = total_mode / sum(total_mode)) |>
mutate(proportion = .data$total_mode / sum(.data$total_mode)) |>
ungroup()

# Pivot
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
1 change: 1 addition & 0 deletions R/tiltPlot-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#' @importFrom tibble tribble
#' @importFrom tidyr drop_na
#' @importFrom tidyr pivot_wider
#' @importFrom tidyselect all_of
#' @importFrom tidyselect matches
#' @importFrom tiltIndicator example_data_factory
#' @importFrom tiltIndicatorAfter profile_emissions
Expand Down
Loading

0 comments on commit df9b87b

Please sign in to comment.