Revisión | 0eeeca691bae73b56cb039d6881c5d01ea5b26ff (tree) |
---|---|
Tiempo | 2024-03-21 20:50:49 |
Autor | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
I modified the obfuscated data set.
@@ -245,25 +245,33 @@ | ||
245 | 245 | |
246 | 246 | df_disagg_obfuscated <- df_ini |> |
247 | 247 | ## mutate(type_of_aid=if_else(type_of_aid %in% c("Ad Hoc Case" , "Individual Application within scheme") , "Other", type_of_aid )) |> |
248 | - filter(type_of_aid %!in% c("Ad Hoc Case" , "Individual Application within scheme"), expenditure_year>=2018) |> | |
249 | - summarise(expenditure_eur=sum(aid_element_eur, na.rm=T), | |
250 | - expenditure_national_currency=sum(aid_element, na.rm=T), | |
248 | + filter(type_of_aid %!in% c("Ad Hoc Case" , "Individual Application within scheme")## , expenditure_year>=2018 | |
249 | + ) |> | |
250 | + summarise(expenditure_eur=sum(aid_element_eur, na.rm=T)## , | |
251 | + ## expenditure_national_currency=sum(aid_element, na.rm=T) | |
252 | + , | |
251 | 253 | .by=c(expenditure_year,member_state_2_letter_codes, aid_instrument , scoreboard_objective, sa_case_number, type_of_aid,case_type)) |> |
252 | - filter(expenditure_eur>0 | expenditure_national_currency>0) |> | |
253 | - arrange(member_state_2_letter_codes, expenditure_year,sa_case_number ) | |
254 | + filter(expenditure_eur>0 ## | expenditure_national_currency>0 | |
255 | + ) |> | |
256 | + arrange(member_state_2_letter_codes, expenditure_year,sa_case_number ) |> | |
257 | + select(member_state_2_letter_codes,sa_case_number,expenditure_year, everything() ) |> | |
258 | + rename("member_state"="member_state_2_letter_codes", | |
259 | + "state_aid_case_number"="sa_case_number", | |
260 | + "year_of_expenditure"="expenditure_year", | |
261 | + "expenditure_in_million_EUR"="expenditure_eur") | |
254 | 262 | |
255 | 263 | |
256 | 264 | save_csv(df_disagg_obfuscated, "disaggregated_data.csv") |
257 | 265 | |
258 | -set.seed(1234) | |
266 | +## set.seed(1234) | |
259 | 267 | |
260 | -df_sample <- df_disagg_obfuscated[sample(nrow(df_disagg_obfuscated), 2e4) ,] |> | |
261 | - arrange(expenditure_year, member_state_2_letter_codes, | |
262 | - sa_case_number, aid_instrument, | |
263 | - scoreboard_objective, type_of_aid, case_type) | |
268 | +## df_sample <- df_disagg_obfuscated[sample(nrow(df_disagg_obfuscated), 2e4) ,] |> | |
269 | +## arrange(expenditure_year, member_state_2_letter_codes, | |
270 | +## sa_case_number, aid_instrument, | |
271 | +## scoreboard_objective, type_of_aid, case_type) | |
264 | 272 | |
265 | 273 | |
266 | -save_excel(df_sample, "sample_obfuscated_data.xlsx") | |
274 | +## save_excel(df_sample, "sample_obfuscated_data.xlsx") | |
267 | 275 | |
268 | 276 | |
269 | 277 |