• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

修订版c76f538985ac6323d72345b18bad141d373d7e8f (tree)
时间2022-07-27 23:09:41
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

Minor modifications to the code.

更改概述

差异

diff -r c89389ba836f -r c76f538985ac R-codes/create_csv_sdmx.R
--- a/R-codes/create_csv_sdmx.R Tue Jul 26 10:14:59 2022 +0200
+++ b/R-codes/create_csv_sdmx.R Wed Jul 27 16:09:41 2022 +0200
@@ -31,7 +31,7 @@
3131 ## gdp <- readRDS("gdp.RDS")
3232
3333 gdp <- read_excel("scb_data.xlsx", "gdp_ameco_long_format") %>%
34- clean_data %>%
34+ clean_data() %>%
3535 rename("time_period"="expenditure_year",
3636 "obs_value"="gdp_eur_bn") %>%
3737 mutate(obs_value=obs_value*1e3) %>%
@@ -201,6 +201,9 @@
201201
202202
203203 write_csv(instruments, "CL_INST+COMP+2.1.csv")
204+write_tsv(instruments, "CL_INST+COMP+2.1.tsv")
205+
206+
204207
205208 df_instrument_fin <- df_instrument_up %>%
206209 ## left_join(y=instruments, by=c("aid_instrument_name"="name_en")) %>%
@@ -276,6 +279,10 @@
276279
277280 write_csv(procedures, "CL_TYPE+COMP+2.1.csv")
278281
282+write_tsv(procedures, "CL_TYPE+COMP+2.1.tsv")
283+
284+
285+
279286 df_procedure_fin <- df_procedure_up %>%
280287 ## left_join(y=procedures, by=c("procedure_name"="name_en")) %>%
281288 left_join(y=procedures, by=c("procedure_name"="NAME_en")) %>%
@@ -1297,6 +1304,25 @@
12971304 write_tsv(objectives_revised_notified,"CL_OBJ_SCB_NOTIFIED+COMP+2.1.tsv")
12981305
12991306
1307+### creation of a DSD file.
1308+
1309+#See https://ec.europa.eu/eurostat/online-help/redisstat-admin/en/TECH_B_structural/#represent-a-dsd-in-tsv
1310+
1311+dsd_ini <- read_csv("dsd-template.csv")
1312+
1313+dsd_save <- dsd_ini |>
1314+ mutate(CONCEPT_SCHEME="CL_OBJ_SCB_NOTIFIED+ESTAT+2.1") |>
1315+ mutate(ID=recode(ID, "INDIC_DE"="CL_OBJ_SCB_NOTIFIED"),
1316+ REPRESENTATION=recode(REPRESENTATION,
1317+ "INDIC_DE+ESTAT+1.0"="CL_OBJ_SCB_NOTIFIED+2.1" ))
1318+
1319+
1320+
1321+
1322+write_csv(dsd_save,"DSD_OBJ_SCB_NOTIFIED+COMP+2.1.csv")
1323+write_tsv(dsd_save,"DSD_OBJ_SCB_NOTIFIED+COMP+2.1.tsv")
1324+
1325+
13001326 ####################################################################à
13011327 ####################################################################à
13021328 ####################################################################à
@@ -1407,6 +1433,26 @@
14071433
14081434
14091435
1436+dsd_case_type_save <- dsd_ini |>
1437+ mutate(CONCEPT_SCHEME="CL_OBJ_SCB+ESTAT+2.1") |>
1438+ mutate(ID=recode(ID, "INDIC_DE"="CL_OBJ_SCB"),
1439+ REPRESENTATION=recode(REPRESENTATION,
1440+ "INDIC_DE+ESTAT+1.0"="CL_OBJ_SCB+2.1" )) |>
1441+ add_row(ID="CL_OBJ_SCB_TYPE",
1442+ TYPE="DIMENSION",
1443+ CONCEPT_SCHEME="CL_OBJ_SCB+ESTAT+2.1",
1444+ CONCEPT_ID="INDIC_DE2",
1445+ REPRESENTATION_TYPE="CODELIST",
1446+ REPRESENTATION="CL_OBJ_SCB_TYPE+COMP+2.1",
1447+ ATTRIBUTE_ATTACHMENT=NA,
1448+ ATTRIBUTE_STATUS=NA
1449+ )
1450+
1451+
1452+
1453+write_csv(dsd_case_type_save,"DSD_OBJ_SCB_OBJ+COMP+2.1.csv")
1454+write_tsv(dsd_case_type_save,"DSD_OBJ_SCB_OBJ+COMP+2.1.tsv")
1455+
14101456
14111457
14121458 print("So far so good")