• 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óne4a6a74540c007e788f71aacf521f49cf45a5aea (tree)
Tiempo2023-01-13 01:46:27
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I finalized the recoding of a couple of variables.

Cambiar Resumen

Diferencia incremental

diff -r 69e500c5d344 -r e4a6a74540c0 R-codes/read_polish_tam_new.R
--- a/R-codes/read_polish_tam_new.R Thu Jan 12 12:29:48 2023 +0100
+++ b/R-codes/read_polish_tam_new.R Thu Jan 12 17:46:27 2023 +0100
@@ -99,63 +99,58 @@
9999
100100
101101
102+aid_instr_new <- c(
103+"Direct grant/ Interest rate subsidy",
104+"Other forms of equity intervention",
105+"Guarantee",
106+"Other",
107+"Soft loan",
108+"Other forms of tax advantage",
109+"Other forms of tax advantage",
110+"",
111+"Other forms of tax advantage",
112+"Other forms of tax advantage",
113+"Loan/ Repayable advances",
114+"Loan/ Repayable advances",
115+"",
116+"",
117+"Other forms of tax advantage",
118+"Tax advantage or tax exemption",
119+"Tax rate reduction",
120+"Provision of risk capital",
121+"Repayable advances",
122+"",
123+"Tax advantage or tax exemption",
124+"Tax advantage or tax exemption"
125+
126+)
127+
128+
129+aid_instr <- df_sel |>
130+ pull(aid_award_instrument) |>
131+ su()
102132
103133
104134
105-saveRDS(df_sel,"tam_PL_matched.RDS")
106-write_csv(df_sel, "tam_PL_matched.csv.gz")
107-save_excel(df_sel, "tam_PL_matched.xlsx")
108-## write_dta(df_sel, "tam_PL_matched.dta")
135+
136+df_sel2 <- df_sel |>
137+ mutate(aid_award_ga_original=df_ini$udzielajacy_nazwa) |>
138+ mutate(aid_award_instrument=recode_many(aid_award_instrument, aid_instr,
139+ aid_instr_new)) |>
140+ mutate(beneficiary_type=if_else(beneficiary_type %in% c("0","1","2", "3"),
141+ "Small and medium-sized enterprises",
142+ "Only large enterprises"))
109143
110144
111-df_sel2 <- df_sel |>
112- mutate(aid_award_ga_original=df_ini$udzielajacy_nazwa)
145+saveRDS(df_sel2,"tam_PL_matched.RDS")
146+write_csv(df_sel2, "tam_PL_matched.csv.gz")
147+save_excel(df_sel2, "tam_PL_matched.xlsx")
148+
113149
114150 saveRDS(df_sel2,"tam_PL_matched_extended.RDS")
115151 write_parquet(df_sel2,"tam_PL_matched_extended.parquet")
116152
117153
118-## mm <- read_excel("PL_matching.xlsx") %>%
119-## clean_names() %>%
120-## select(-translate) %>%
121-## mutate(original=make_clean_names(original),
122-## match=make_clean_names(match)) %>%
123-## select(match, original) %>%
124-## pattern_to_pattern("na", "na_1")
125-
126-
127-
128-## mm2 <- deframe(mm)
129-
130-
131-## df_fin <- df_ini %>% rename(!!! mm2)
132-
133-
134-
135-## %>%
136-## select(-starts_with("na_")) %>%
137-## mutate(beneficiary_country="Poland") %>%
138-## mutate(year=year(aid_award_granted_date)) %>%
139-## mutate(case_reference=substrLeft(case_reference, 8)) %>%
140-## left_join(y=all_rates_ini, by=c("year"="time_period")) %>%
141-## mutate(nominal_aid_absolute_eur=as.numeric(nominal_aid_absolute_eur)/obs_value) %>%
142-## select(-obs_value) %>%
143-## mutate(nominal_aid_absolute_eur=as.character(nominal_aid_absolute_eur))
144-
145-
146-
147-
148-## df_tot2 <- df_tot %>% rename(!!! mm2) %>%
149-## select(-starts_with("na_")) %>%
150-## mutate(beneficiary_country="Poland") %>%
151-## mutate(year=year(aid_award_granted_date)) %>%
152-## mutate(case_reference=substrLeft(case_reference, 8)) %>%
153-## left_join(y=all_rates_ini, by=c("year"="time_period")) %>%
154-## mutate(nominal_aid_absolute_eur=as.numeric(nominal_aid_absolute_eur)/obs_value) %>%
155-## select(-obs_value) %>%
156-## mutate(nominal_aid_absolute_eur=as.character(nominal_aid_absolute_eur))
157-
158-
159154
160155
161156