• 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óndd75d4b0efc15b7e57f53604d221f6e8289bc90e (tree)
Tiempo2023-01-31 06:56:27
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I added an option to save and read the ESTAT data.

Cambiar Resumen

Diferencia incremental

diff -r 171bb0230e69 -r dd75d4b0efc1 R-codes/read_polish_tam_new.R
--- a/R-codes/read_polish_tam_new.R Mon Jan 30 22:19:29 2023 +0100
+++ b/R-codes/read_polish_tam_new.R Mon Jan 30 22:56:27 2023 +0100
@@ -15,6 +15,7 @@
1515
1616 ## df_ini2 <- read_excel("State_aid_in_Poland-2018-2019_above_500K_euro,_2020_above_100K_euro.xlsx")
1717
18+read_estat <- 0
1819
1920 df_ini1 <- read_csv("State_aid_in_Poland-2018-2019_above_500K_euro,_2020_above_100K_euro.csv" ## , locale = readr::locale(encoding = "latin1")
2021 ) |>
@@ -28,12 +29,21 @@
2829 query <- "ert_bil_eur_a/A.AVG.NAC.PLN"
2930
3031
31-all_rates_ini <- estat_retrieval(query) %>%
32+if (read_estat!=1){
33+ all_rates_ini <- estat_retrieval(query) %>%
3234 clean_names() %>%
3335 select(time_period, obs_value) %>%
3436 mutate(time_period=as.numeric(time_period))
3537
3638
39+ saveRDS(all_rates_ini, "all_rates.RDS")
40+
41+
42+} else{
43+
44+
45+ all_rates_ini <- readRDS("all_rates.RDS")
46+}
3747
3848
3949
@@ -154,6 +164,8 @@
154164 pull(aid_award_instrument) |>
155165 su()
156166
167+nace <- readRDS("../../nace_codes/df_nace.RDS") |>
168+ select(-code2)
157169
158170
159171
@@ -163,7 +175,14 @@
163175 aid_instr_new)) |>
164176 mutate(beneficiary_type=if_else(beneficiary_type %in% c("0","1","2"),
165177 "Small and medium-sized enterprises",
166- "Only large enterprises"))
178+ "Only large enterprises")) |>
179+ mutate(beneficiary_sector=case_match(beneficiary_sector,
180+ "60.21"~"60.20",
181+ .default=beneficiary_sector)) |>
182+ left_join(y=nace, by=c("beneficiary_sector"="code")) |>
183+ mutate(beneficiary_sector=paste(beneficiary_sector, description,
184+ sep=" - ")) |>
185+ select(-description)
167186
168187
169188 saveRDS(df_sel2,"tam_PL_matched.RDS")