Code
load_data("oecd/QASA_TABLE801.RData")
load_data("oecd/QASA_TABLE801_var.RData")Data - OECD
load_data("oecd/QASA_TABLE801.RData")
load_data("oecd/QASA_TABLE801_var.RData")QASA_TABLE801 %>%
left_join(QASA_TABLE801_var$TRANSACTION %>% rename(TRANSACTION_desc = label), by = c("TRANSACTION" = "id")) %>%
group_by(TRANSACTION, TRANSACTION_desc, SECTOR, MEASURE, TIME_FORMAT, ADJUSTED) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}QASA_TABLE801_var$SECTOR %>%
{if (is_html_output()) print_table(.) else .}| id | label |
|---|---|
| S1 | Total economy |
| S11 | Non-financial corporations |
| S11DO | Domestically controlled non-financial corporations |
| S11001 | Public non financial corporations |
| S11002 | National private non financial corporations |
| S12 | Financial corporations |
| S12K | Monetary financial institutions (MFI) |
| S12P | Other financial institutions (Financial corporations other than MFIs, insurance corporations and pension funds) |
| S12Q | Insurance corporations and pension funds |
| S13 | General government |
| S14_S15 | Households and non-profit institutions serving households |
| S14 | Households |
| S15 | Non-profit institutions serving households |
| SN | Not sectorized |
| S2 | Rest of the world |
QASA_TABLE801_var$MEASURE %>%
{if (is_html_output()) print_table(.) else .}| id | label |
|---|---|
| CAR | Current prices, annual levels |
| CQR | Current prices, quarterly levels |
| PER | Persons |
| HRS | Hours worked |
QASA_TABLE801_var$VAR_DESC %>%
{if (is_html_output()) print_table(.) else .}| id | description |
|---|---|
| LOCATION | Country |
| TRANSACTION | Transaction |
| SECTOR | Sector |
| MEASURE | Measure |
| ADJUSTED | Adjusted |
| TIME | Period & Frequency |
| OBS_VALUE | Observation Value |
| TIME_FORMAT | Time Format |
| OBS_STATUS | Observation Status |
| UNIT | Unit |
| POWERCODE | Unit multiplier |
| REFERENCEPERIOD | Reference period |
QASA_TABLE801_var$TRANSACTION %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}QASA_TABLE801_var$ADJUSTED %>%
{if (is_html_output()) print_table(.) else .}| id | label |
|---|---|
| NSA | Not seasonally adjusted |
| SA | Seasonally adjusted |
QASA_TABLE801 %>%
# K1PAY: Consumption of fixed capital
# P5PAY: Gross capital formation
# B1GPAY: Gross domestic product / Gross value added
filter(TRANSACTION %in% c("P5PAY", "K1PAY", "B1GPAY"),
SECTOR == "S1",
MEASURE == "CQR",
TIME_FORMAT == "P1Y",
ADJUSTED == "NSA") %>%
left_join(QASA_TABLE801_var$LOCATION, by = c("LOCATION" = "id")) %>%
select(Country = label, TRANSACTION, obsTime, obsValue) %>%
filter(substr(obsTime, 6, 6) != "Q") %>%
arrange(Country, obsTime, TRANSACTION) %>%
spread(TRANSACTION, obsValue) %>%
group_by(Country, obsTime) %>%
summarise(obsValue = (P5PAY - K1PAY) / B1GPAY) %>%
group_by(Country) %>%
summarise(year_first = first(obsTime),
value_first = first(obsValue),
year_last = last(obsTime),
value_last = last(obsValue)) %>%
na.omit %>%
mutate_at(vars(value_first, value_last),
funs(ifelse(!is.na(.), paste0(round(100*., digits = 1), " %"), .))) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}