Revisión | e4a6a74540c007e788f71aacf521f49cf45a5aea (tree) |
---|---|
Tiempo | 2023-01-13 01:46:27 |
Autor | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
I finalized the recoding of a couple of variables.
@@ -99,63 +99,58 @@ | ||
99 | 99 | |
100 | 100 | |
101 | 101 | |
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() | |
102 | 132 | |
103 | 133 | |
104 | 134 | |
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")) | |
109 | 143 | |
110 | 144 | |
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 | + | |
113 | 149 | |
114 | 150 | saveRDS(df_sel2,"tam_PL_matched_extended.RDS") |
115 | 151 | write_parquet(df_sel2,"tam_PL_matched_extended.parquet") |
116 | 152 | |
117 | 153 | |
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 | - | |
159 | 154 | |
160 | 155 | |
161 | 156 |