修订版 | 53c5a2fbc6b200fcc9d003e3f0e8a0d7740389aa (tree) |
---|---|
时间 | 2024-02-07 01:52:35 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
Another script to obtain a special granular aggregation from the scoreboard.
@@ -0,0 +1,37 @@ | ||
1 | +rm(list=ls()) | |
2 | + | |
3 | +library(tidyverse) | |
4 | +library(janitor) | |
5 | +library(openxlsx) | |
6 | + | |
7 | + | |
8 | + | |
9 | +source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R") | |
10 | + | |
11 | +df_ini <- readRDS("../scoreboard.RDS") | |
12 | + | |
13 | + | |
14 | + | |
15 | +df <- df_ini |> | |
16 | + filter(scoreboard_objective=="Environmental protection including energy savings") |> | |
17 | + filter(type_of_aid %!in% c( "Ad Hoc Case", "Individual Application within scheme" )) |> | |
18 | + group_by(member_state,member_state_2_letter_codes, expenditure_year, | |
19 | + sa_case_number, type_of_aid, working_title, case_type, | |
20 | + aid_instrument,record_type, | |
21 | + co_financed, primary_objective, scoreboard_objective, | |
22 | + all_gber_obj,all_sec_obj, | |
23 | + harmonised_aid_instrument, | |
24 | + harmonised_primary_obj | |
25 | + ) |> | |
26 | + summarise(aid_element_million_eur=sum(aid_element_eur, na.rm=T), | |
27 | + nominal_amount_million_eur=sum(nominal_amount_eur, na.rm=T)) |> | |
28 | + ungroup() |> | |
29 | + filter(aid_element_million_eur>0 | nominal_amount_million_eur >0 ) |> | |
30 | + rename("GBER_objective"="all_gber_obj", | |
31 | + "sector_objective"="all_sec_obj", | |
32 | + "harmonised_primary_objective"="harmonised_primary_obj") | |
33 | + | |
34 | +save_excel(df,"EEAG_extraction.xlsx") | |
35 | + | |
36 | + | |
37 | +print("So far so good") |