• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#windowsobjective-ccocoaqtpython誰得phprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión9451dab8a6c050e76bbb740c416f16935a801ff8 (tree)
Tiempo2023-01-19 18:34:03
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

Almost final form of the script to process the Romanian tam data.

Cambiar Resumen

Diferencia incremental

diff -r 324cf8383efa -r 9451dab8a6c0 R-codes/process_tam_RO.R
--- a/R-codes/process_tam_RO.R Wed Jan 18 16:31:22 2023 +0100
+++ b/R-codes/process_tam_RO.R Thu Jan 19 10:34:03 2023 +0100
@@ -33,22 +33,22 @@
3333 clean_names() |>
3434 select(-c(text_integral_masura, executanti))
3535
36-df_name <- read_csv("correspondence.csv") |>
36+df_name <- read_csv("correspondence_modified.csv") |>
3737 clean_names() |>
3838 pattern_to_na("...") |>
3939 complete_data()
4040
41-tam_names <- c("id", "case_reference", "aid_award_created_date", "aid_award_granted_date",
42-"aid_award_published_date", "aid_award_reference", "case_title_original",
43-"case_title_english", "main_procedure_type_code", "is_co_finance",
44-"aid_award_objective", "aid_award_objective_other_english", "aid_award_instrument",
45-"aid_award_instrument_other_english", "beneficiary_name", "beneficiary_name_english",
46-"national_identification", "national_identification_type", "beneficiary_type",
47-"beneficiary_country", "beneficiary_region", "beneficiary_sector",
48-"granted_aid_absolute_eur", "nominal_aid_absolute_eur", "granted_range_eur",
49-"aid_award_ga_original", "aid_award_ga_english", "aid_award_nuts_code",
50-"creator_country", "year", "granted_value_extended_eur", "nominal_value_extended_eur",
51-"is_covid_case")
41+## tam_names <- c("id", "case_reference", "aid_award_created_date", "aid_award_granted_date",
42+## "aid_award_published_date", "aid_award_reference", "case_title_original",
43+## "case_title_english", "main_procedure_type_code", "is_co_finance",
44+## "aid_award_objective", "aid_award_objective_other_english", "aid_award_instrument",
45+## "aid_award_instrument_other_english", "beneficiary_name", "beneficiary_name_english",
46+## "national_identification", "national_identification_type", "beneficiary_type",
47+## "beneficiary_country", "beneficiary_region", "beneficiary_sector",
48+## "granted_aid_absolute_eur", "nominal_aid_absolute_eur", "granted_range_eur",
49+## "aid_award_ga_original", "aid_award_ga_english", "aid_award_nuts_code",
50+## "creator_country", "year", "granted_value_extended_eur", "nominal_value_extended_eur",
51+## "is_covid_case")
5252 ## names(tam)
5353
5454
@@ -74,7 +74,8 @@
7474 ) |>
7575 mutate(case_reference=select_left_pattern(case_reference, "/")) |>
7676 mutate( is_covid_case=if_else(case_reference %in% covid$case_reference,
77- "Yes", "No") )
77+ "Yes", "No") ) |>
78+ mutate(national_identification=as.character(national_identification))
7879
7980
8081
@@ -91,7 +92,7 @@
9192
9293
9394
94-aid <- read_csv("aid_type.csv") |>
95+aid <- read_csv("aid_type_modified.csv") |>
9596 complete_data() |>
9697 mutate(aid_instrument_rom=tolower(aid_instrument_rom))
9798
@@ -99,11 +100,13 @@
99100 "întreprindere mică",
100101 "întreprindere mijlocie",
101102 "întreprindere mare",
102- "altă categorie de întreprindere"),
103+ "altă categorie de întreprindere",
104+ "imm"),
103105 new=c("Small and medium-sized enterprises",
104106 "Small and medium-sized enterprises",
105107 "Small and medium-sized enterprises",
106108 "Only large enterprises",
109+ "",
107110 ""
108111 ))
109112
@@ -119,7 +122,7 @@
119122
120123 select(-c(amount_of_aid_awarded_per_sub_category_in_romanian_lei,obs_value)) |>
121124 mutate(beneficiary_sector=as.character(beneficiary_sector)) |>
122- rename("case_title"="case_title_original",
125+ rename(## "case_title"="case_title_original",
123126 "aid_award_instrument_other_english"="aid_award_instrument") |>
124127 mutate(aid_award_instrument_other_english=tolower(aid_award_instrument_other_english)) |>
125128 mutate(aid_award_instrument_other_english=recode_many(aid_award_instrument_other_english, aid$aid_instrument_rom ,aid$aid_instrument_eng)) |>
@@ -146,7 +149,9 @@
146149 "nominal_aid_absolute_eur", "granted_aid_absolute_eur",
147150 "beneficiary_region" , "beneficiary_sector" ,
148151 "case_reference" , "beneficiary_country" ,
149- "year")
152+ "national_identification",
153+ "year" , "case_title_original"
154+ )
150155
151156 ## microîntreprindere Small and medium-sized enterprises
152157 ## întreprindere mică Small and medium-sized enterprises
@@ -166,7 +171,7 @@
166171 rename("aid_award_instrument"="aid_award_instrument_other_english") |>
167172 select(any_of(nn)) |>
168173 mutate(beneficiary_country="Romania") |>
169- mutate(nominal_value_extended_eur=nominal_aid_absolute_eur,
174+ mutate(nominal_value_extended_eur=granted_aid_absolute_eur,
170175 granted_value_extended_eur=granted_aid_absolute_eur,
171176 is_covid_case=if_else(case_reference %in% covid$case_reference, "Yes", "No")) |>
172177 mutate(granted_value_extended_eur=if_else(is_covid_case=="No", granted_value_extended_eur, NA_real_)) |>