• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisióne946b59fa3b62251c486fe1185eb50a34c80cdcf (tree)
Tiempo2023-05-05 19:27:18
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I now use also another file for the used and approuved aid.

Cambiar Resumen

Diferencia incremental

diff -r aaf0cf2df644 -r e946b59fa3b6 R-codes/create_csv_sdmx.R
--- a/R-codes/create_csv_sdmx.R Mon Apr 24 11:09:10 2023 +0200
+++ b/R-codes/create_csv_sdmx.R Fri May 05 12:27:18 2023 +0200
@@ -423,6 +423,48 @@
423423 "GEO"="iso2")
424424
425425
426+
427+## df_gber_objective_up <- df %>%
428+## ## filter(!is.na(all_objective_names_gber_only)) %>%
429+
430+## mutate(amount_spent_aid_element_in_eur_million=if_else(!is.na(all_objective_names_gber_only),amount_spent_aid_element_in_eur_million, 0 )) %>%
431+
432+## mutate(aid_element_as_percent_national_gdp=if_else(!is.na(all_objective_names_gber_only),aid_element_as_percent_national_gdp, 0 )) %>%
433+
434+## mutate(aid_element_eur_adj=if_else(!is.na(all_objective_names_gber_only),aid_element_eur_adj, 0 )) %>%
435+
436+## mutate(all_objective_names_gber_only=
437+## recode(all_objective_names_gber_only,
438+## "Transport costs of goods in eligible areas (Art. 15(2))"= "Transport costs of goods in eligible areas (Art. 15(2)(a))"
439+## )) %>%
440+## group_by(year, iso2, all_objective_names_gber_only) %>%
441+## summarise(value=sum(amount_spent_aid_element_in_eur_million, na.rm=T),
442+## pc_gdp=sum(aid_element_as_percent_national_gdp, na.rm=T),
443+## value_adj=sum(aid_element_eur_adj, na.rm=T)
444+## ) %>%
445+## ungroup %>%
446+## ## left_join(y=gdp, by=c("year"="time_period",
447+## ## "iso2"="geo")) %>%
448+## ## mutate(pc_gdp=value/obs_value*100) %>%
449+## group_by(year, iso2) %>%
450+## mutate(value=round_preserve_sum(value,2),
451+## pc_gdp=round_preserve_sum(pc_gdp,2),
452+## value_adj=round_preserve_sum(value_adj,2)) %>%
453+## group_modify(~ .x %>%
454+## adorn_totals("row", fill="Total")) %>%
455+## ungroup %>%
456+## ## select(-obs_value) %>%
457+## mutate(DATAFLOW="COMP:AID_SCB_TYPE(1.0)",
458+## FREQ="A") %>%
459+## rename("MIO_EUR"="value",
460+## "PC_GDP"="pc_gdp",
461+## "MIO_EUR_ADJ"="value_adj") %>%
462+## pivot_longer(cols=c(PC_GDP, MIO_EUR, MIO_EUR_ADJ), names_to="UNIT",
463+## values_to="OBS_VALUE") %>%
464+## rename("TIME_PERIOD"="year",
465+## "GEO"="iso2")
466+
467+
426468 ## objectives_gber <- read_csv("CL_OBJ_GBER+COMP+1.0.csv") %>%
427469 ## clean_data()
428470
@@ -947,7 +989,30 @@
947989 INST_FI,TIME_PERIOD, OBS_VALUE)
948990
949991
950- used_13 <- bind_rows(used1, used2, used3) |>
992+
993+used4 <- read_csv("other_used2.csv") %>%
994+ rename("country"="Member State") %>%
995+ mutate(country=recode(country, "Czech Republic"="Czechia")) %>%
996+ mutate(UNIT="MIO_EUR", FREQ="A") %>%
997+ pivot_longer(cols=starts_with("2"),
998+ names_to="TIME_PERIOD",
999+ values_to="OBS_VALUE") %>%
1000+ mutate(TIME_PERIOD=as.numeric(TIME_PERIOD),
1001+ OBS_VALUE=as.numeric(OBS_VALUE)) %>%
1002+ na_num_to_pattern(0) %>%
1003+ mutate(INST_FI="INST4") %>%
1004+ left_join(y=iso_map_eu28, by="country") %>%
1005+ rename("GEO"="iso2") %>%
1006+ mutate(DATAFLOW="COMP:AID_FI_USED(1.0)") %>%
1007+ complete(GEO, UNIT, INST_FI,
1008+ DATAFLOW, FREQ, TIME_PERIOD, fill=list(OBS_VALUE=0)) %>%
1009+ select(DATAFLOW, FREQ, GEO,UNIT,
1010+ INST_FI,TIME_PERIOD, OBS_VALUE)
1011+
1012+
1013+
1014+
1015+ used_13 <- bind_rows(used1, used2, used3, used4) |>
9511016 filter(GEO!="UK") ## this year I remove the UK
9521017
9531018 used_total <- used_13 %>%
@@ -973,7 +1038,8 @@
9731038
9741039
9751040 df_used_finance_fin_save <- df_used_finance_fin%>%
976- mutate(OBS_VALUE=format_col(OBS_VALUE,2,""))
1041+ mutate(OBS_VALUE=format_col(OBS_VALUE,2,"")) |>
1042+ filter(GEO!="UK")
9771043
9781044 write_csv(df_used_finance_fin_save, "./finance_used/aid_fi_used+COMP+3.0.sdmx.csv")
9791045 write_tsv(df_used_finance_fin_save, "./finance_used/aid_fi_used+COMP+3.0.sdmx.tsv")
@@ -1049,7 +1115,31 @@
10491115 INST_FI,TIME_PERIOD, OBS_VALUE)
10501116
10511117
1052-used_13 <- bind_rows(used1, used2, used3)
1118+
1119+used4 <- read_csv("other_approuved2.csv") %>%
1120+ rename("country"="Member State") %>%
1121+ mutate(country=recode(country, "Czech Republic"="Czechia")) %>%
1122+ mutate(UNIT="MIO_EUR", FREQ="A") %>%
1123+ pivot_longer(cols=starts_with("2"),
1124+ names_to="TIME_PERIOD",
1125+ values_to="OBS_VALUE") %>%
1126+ mutate(TIME_PERIOD=as.numeric(TIME_PERIOD),
1127+ OBS_VALUE=as.numeric(OBS_VALUE)) %>%
1128+ na_num_to_pattern(0) %>%
1129+ mutate(INST_FI="INST4") %>%
1130+ left_join(y=iso_map_eu28, by="country") %>%
1131+ rename("GEO"="iso2") %>%
1132+ mutate(DATAFLOW="COMP:AID_FI_APPROVED(1.0)") %>%
1133+ complete(GEO, UNIT, INST_FI,
1134+ DATAFLOW, FREQ, TIME_PERIOD, fill=list(OBS_VALUE=0)) %>%
1135+ select(DATAFLOW, FREQ, GEO,UNIT,
1136+ INST_FI,TIME_PERIOD, OBS_VALUE)
1137+
1138+
1139+
1140+
1141+
1142+used_13 <- bind_rows(used1, used2, used3, used4)
10531143
10541144 used_total <- used_13 %>%
10551145 group_by(DATAFLOW, FREQ, GEO, UNIT, TIME_PERIOD ) %>%
@@ -1075,7 +1165,8 @@
10751165
10761166
10771167 df_approved_finance_fin_save <- df_approved_finance_fin %>%
1078- mutate(OBS_VALUE=format_col(OBS_VALUE,2,""))
1168+ mutate(OBS_VALUE=format_col(OBS_VALUE,2,"")) |>
1169+ filter(GEO!="UK")
10791170
10801171
10811172 write_csv(df_approved_finance_fin_save, "./finance_approuved/aid_fi_approved+COMP+3.0.sdmx.csv")