• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

修订版4d0a0af349fed4acb9398346163be6281370ab6c (tree)
时间2024-09-18 02:59:18
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

A cleanup of the script and its file management.

更改概述

差异

diff -r 7fab32ec9541 -r 4d0a0af349fe R-codes/process_tam_RO.R
--- a/R-codes/process_tam_RO.R Tue Sep 17 19:52:57 2024 +0200
+++ b/R-codes/process_tam_RO.R Tue Sep 17 19:59:18 2024 +0200
@@ -26,14 +26,14 @@
2626 ## df_ro_ini <- read_csv("ExportTransparenta_20230403.csv") |>
2727 ## clean_names()
2828
29-df_ro_ini <- read_csv("ExportTransparency.csv") |>
29+df_ro_ini <- read_csv("../input/ExportTransparency.csv") |>
3030 clean_names()
3131
3232
3333 repeated_entries <- df_ro_ini |>
3434 get_dupes_short()
3535
36-save_excel(repeated_entries, "repeated_entries_Romania.xlsx")
36+save_excel(repeated_entries, "../output/repeated_entries_Romania.xlsx")
3737
3838 ## tam <- read_parquet("tam.parquet") |>
3939 ## slice(1:5)
@@ -56,29 +56,17 @@
5656 clean_names() |>
5757 select(-c(text_integral_masura, executanti))
5858
59-df_name <- read_csv("correspondence_modified.csv") |>
59+df_name <- read_csv("../input/correspondence_modified.csv") |>
6060 clean_names() |>
6161 pattern_to_na("...") |>
6262 complete_data()
6363
64-## tam_names <- c("id", "case_reference", "aid_award_created_date", "aid_award_granted_date",
65-## "aid_award_published_date", "aid_award_reference", "case_title_original",
66-## "case_title_english", "main_procedure_type_code", "is_co_finance",
67-## "aid_award_objective", "aid_award_objective_other_english", "aid_award_instrument",
68-## "aid_award_instrument_other_english", "beneficiary_name", "beneficiary_name_english",
69-## "national_identification", "national_identification_type", "beneficiary_type",
70-## "beneficiary_country", "beneficiary_region", "beneficiary_sector",
71-## "granted_aid_absolute_eur", "nominal_aid_absolute_eur", "granted_range_eur",
72-## "aid_award_ga_original", "aid_award_ga_english", "aid_award_nuts_code",
73-## "creator_country", "year", "granted_value_extended_eur", "nominal_value_extended_eur",
74-## "is_covid_case")
75- ## names(tam)
7664
7765
7866 ini_names <- names(df_ro)
7967
8068
81-covid <- read_excel("SA-Covid19.xlsx") |>
69+covid <- read_csv("../../tam_arrow/input/csv_files/SA-Covid19.csv") |>
8270 clean_names() |>
8371 filter(member_state_2_letter_code=="RO")
8472
@@ -119,19 +107,19 @@
119107 clean_names() |>
120108 select(time_period, obs_value) |>
121109 mutate(time_period=as.numeric(time_period))
122- saveRDS(all_rates_ini, "all_rates.RDS")
110+ saveRDS(all_rates_ini, "../input/all_rates.RDS")
123111
124112
125113
126114 } else{
127115
128-all_rates_ini <- readRDS("all_rates.RDS")
116+all_rates_ini <- readRDS("../input/all_rates.RDS")
129117
130118 }
131119
132120
133121
134-aid <- read_csv("aid_type_modified.csv") |>
122+aid <- read_csv("../input/aid_type_modified.csv") |>
135123 complete_data() |>
136124 mutate(aid_instrument_rom=tolower(aid_instrument_rom))
137125
@@ -202,10 +190,10 @@
202190 ## slice(6:nrow(.))
203191
204192
205-covid <- read_excel("SA-Covid19.xlsx") |>
206- clean_names()
193+## covid <- read_excel("SA-Covid19.xlsx") |>
194+## clean_names()
207195
208-nace <- readRDS("../nace_codes/df_nace.RDS") |>
196+nace <- readRDS("../input/df_nace.RDS") |>
209197 select(-code)
210198
211199 df_nace <- tibble(macro=seq_fixed_width(1:99,2),
@@ -260,13 +248,19 @@
260248
261249
262250
263-save_excel(df.out, "romania_extra_tam.xlsx")
251+save_excel(df.out, "../output/romania_extra_tam.xlsx")
264252
265-write_csv(df.out, "romania_extra_tam.csv.gz")
266-write_csv(df.out, "romania_extra_tam.csv")
253+write_csv(df.out, "../output/romania_extra_tam.csv.gz")
254+write_csv(df.out, "../output/romania_extra_tam.csv")
267255 ## write_dta(df.out, "romania_extra_tam.dta")
268-saveRDS(df.out, "romania_extra_tam.RDS")
256+saveRDS(df.out, "../output/romania_extra_tam.RDS")
269257
270-write_parquet(df.out, "romania_extra.parquet")
258+remove_file("../output/romania_extra.parquet")
259+write_parquet(df.out, "../output/romania_extra.parquet")
260+
261+remove_file("../../tam_arrow/input/parquet-files/romania/romania_extra.parquet")
262+
263+write_parquet(df.out, "../../tam_arrow/input/parquet-files/romania/romania_extra.parquet")
264+
271265
272266 print("So far so good")