Consumer price indices (CPIs)

Data - OECD

Info

source dataset Title .html .rData
oecd PRICES_CPI Consumer price indices (CPIs) 2026-08-11 2026-08-02

Data on inflation

source dataset Title .html .rData
oecd PRICES_CPI Consumer price indices (CPIs) 2026-08-11 2026-08-02
bis CPI Consumer Price Index 2026-08-11 2026-08-11
ecb CES Consumer Expectations Survey 2026-08-12 2026-08-02
eurostat nama_10_co3_p3 Final consumption expenditure of households by consumption purpose (COICOP 3 digit) 2026-08-08 2026-08-11
eurostat prc_hicp_cow HICP - country weights 2026-08-12 2026-08-11
eurostat prc_hicp_ctrb Contributions to euro area annual inflation (in percentage points) 2026-08-12 2026-08-11
eurostat prc_hicp_inw HICP - item weights 2026-08-12 2026-08-11
eurostat prc_hicp_manr HICP (2015 = 100) - monthly data (annual rate of change) 2026-08-12 2026-08-11
eurostat prc_hicp_midx HICP (2015 = 100) - monthly data (index) 2026-08-12 2026-08-11
eurostat prc_hicp_mmor HICP (2015 = 100) - monthly data (monthly rate of change) 2026-08-12 2026-08-11
eurostat prc_ppp_ind Purchasing power parities (PPPs), price level indices and real expenditures for ESA 2010 aggregates 2026-08-12 2026-08-11
eurostat sts_inpp_m Producer prices in industry, total - monthly data 2026-08-12 2026-08-11
eurostat sts_inppd_m Producer prices in industry, domestic market - monthly data 2026-08-12 2026-08-11
eurostat sts_inppnd_m Producer prices in industry, non domestic market - monthly data 2026-08-12 2026-08-11
fred cpi Consumer Price Index 2026-08-11 2026-08-11
fred inflation Inflation 2026-08-11 2026-08-11
imf CPI Consumer Price Index (CPI) 2026 February - CPI_2026_FEB_VINTAGE 2026-08-11 2026-08-11
oecd MEI_PRICES_PPI Producer Prices - MEI_PRICES_PPI 2026-08-11 2026-08-02
oecd PPP2017 2017 PPP Benchmark results 2026-08-11 2026-08-02
wdi FP.CPI.TOTL.ZG Inflation, consumer prices (annual %) 2026-08-11 2026-08-11
wdi NY.GDP.DEFL.KD.ZG Inflation, GDP deflator (annual %) 2026-08-11 2026-08-11

Parts

dataset LAST_DOWNLOAD
PRICES_CPI NA
PRICES_CPI_5 NA
PRICES_CPI_4 NA
PRICES_CPI_3 NA
PRICES_CPI_2 NA
PRICES_CPI_1 NA

Last

Monthly

obsTime Nobs
2026-03 91

Quarterly

obsTime Nobs
2026-Q1 69

Annual

obsTime Nobs
2025 2479

Nobs

all

Code
PRICES_CPI |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject, MEASURE, FREQUENCY) |>
  summarise(Nobs = sum(!is.na(obsValue))) |>
  arrange(-Nobs) |>
  print_table_conditional()

Annual, IXOB

Code
PRICES_CPI |>
  filter(MEASURE == "IXOB",
         FREQUENCY == "A") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(nobs = sum(!is.na(obsValue))) |>
  arrange(-nobs) |>
  print_table_conditional()
SUBJECT Subject nobs
CPALTT01 CPI: 01-12 - All items 2875
CP010000 CPI: 01 - Food and non-Alcoholic beverages 2224
PWCP0100 CPI weights: 01 - Food and non-Alcoholic beverages 2224
CPGREN01 CPI: Energy 2047
CPGRLE01 CPI: All items non-food non-energy 2015
CP040100 CPI: 04.1 - CPI Actual rentals for housing 1422
PWCP0410 CPI weights: 04.1 - Actual Rentals for Housing 1422
CP080000 CPI: 08 - Communication 1245
PWCP0400 CPI weights: 04 - Housing, water, electricity, gas and other fuels 1245
PWCP0800 CPI weights: 08 - Communication 1245
CP030000 CPI: 03 - Clothing and footwear 1206
PWCP0300 CPI weights: 03 - Clothing and footwear 1206
PWCP0500 CPI weights: 05 - Furnishings, household equipment and routine household maintenance 1206
PWCP0900 CPI weights: 09 - Recreation and culture 1206
CP110000 CPI: 11 - Restaurants and hotels 1197
PWCP1100 CPI weights: 11 - Restaurants and hotels 1197
PWCP1000 CPI weights: 10 - Education 1191
PWCP1200 CPI weights: 12 - Miscellaneous goods and services 1191
CP020000 CPI: 02 - Alcoholic beverages, tobacco and narcotics 1167
PWCP0200 CPI weights: 02 - Alcoholic beverages, tobacco and narcotics 1167
PWCP0600 CPI weights: 06 - Health 1150
PWCP0700 CPI weights: 07 - Transport 1113
CPHPTT01 HICP: All items 946
CPGRHO01 CPI: Housing 921
CPGRLH01 CPI: Services less housing 639
CP040200 CPI: 04.2 - CPI Imputed rentals for housing 619
PWCP0420 CPI weights: 04.2 - Imputed Rentals for Housing 619

SUBJECT

CPI - COICOP

Code
i_g("bib/oecd/PRICES_CPI_COICOP.png")

CPI Weights

Code
i_g("bib/oecd/PRICES_CPI_weights.png")

CPI - HICP

Code
i_g("bib/oecd/PRICES_CPI_HICP.png")

List

Code
PRICES_CPI |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(Nobs = sum(!is.na(obsValue))) |>
  arrange(-Nobs) |>
  print_table_conditional()
SUBJECT Subject Nobs
CPALTT01 CPI: 01-12 - All items 144121
CP010000 CPI: 01 - Food and non-Alcoholic beverages 120605
PWCP0100 CPI weights: 01 - Food and non-Alcoholic beverages 120605
CPGREN01 CPI: Energy 106452
CPGRLE01 CPI: All items non-food non-energy 106075
CP040100 CPI: 04.1 - CPI Actual rentals for housing 75914
PWCP0410 CPI weights: 04.1 - Actual Rentals for Housing 75914
PWCP0400 CPI weights: 04 - Housing, water, electricity, gas and other fuels 68348
CP080000 CPI: 08 - Communication 68141
PWCP0800 CPI weights: 08 - Communication 68141
PWCP0500 CPI weights: 05 - Furnishings, household equipment and routine household maintenance 67760
PWCP0900 CPI weights: 09 - Recreation and culture 67760
CP110000 CPI: 11 - Restaurants and hotels 67311
PWCP1100 CPI weights: 11 - Restaurants and hotels 67311
PWCP0600 CPI weights: 06 - Health 67123
PWCP1200 CPI weights: 12 - Miscellaneous goods and services 66995
CP030000 CPI: 03 - Clothing and footwear 66857
PWCP0300 CPI weights: 03 - Clothing and footwear 66857
CP020000 CPI: 02 - Alcoholic beverages, tobacco and narcotics 65783
PWCP0200 CPI weights: 02 - Alcoholic beverages, tobacco and narcotics 65783
PWCP1000 CPI weights: 10 - Education 65702
PWCP0700 CPI weights: 07 - Transport 64406
CPGRHO01 CPI: Housing 47544
CPHPTT01 HICP: All items 36166
CPGRLH01 CPI: Services less housing 32069
CP040200 CPI: 04.2 - CPI Imputed rentals for housing 32064
PWCP0420 CPI weights: 04.2 - Imputed Rentals for Housing 32064

MEASURE

Code
PRICES_CPI |>
  left_join(PRICES_CPI_var$MEASURE, by = "MEASURE") |>
  group_by(MEASURE, Measure) |>
  summarise(Nobs = sum(!is.na(obsValue))) |>
  arrange(-Nobs) |>
  print_table_conditional()
MEASURE Measure Nobs
IXOB Index 594224
GP Percentage change from previous period 586241
GY Percentage change on the same period of the previous year 572258
CTGY Contribution to annual inflation 152851
AL Per thousand of the National CPI Total 28297

LOCATION

Code
PRICES_CPI |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  group_by(LOCATION, Location) |>
  summarise(Nobs = sum(!is.na(obsValue))) |>
  arrange(-Nobs) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

obsTime

Code
PRICES_CPI |>
  filter(!is.na(obsValue)) |>
  group_by(obsTime) |>
  summarise(Nobs = n()) |>
  arrange(desc(obsTime)) |>
  print_table_conditional()

Contributions to inflation

English

US

Code
line_US <- PRICES_CPI |>
  filter(MEASURE == "CTGY",
         LOCATION %in% c("USA"),
         SUBJECT %in% c("CPALTT01", "CPGREN01", "CP010000", "CP020000")) |>
  month_to_date() |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, obsValue, SUBJECT) |>
  spread(SUBJECT, obsValue) |>
  transmute(date, `Total inflation` = CPALTT01,
            FOOD = CP010000 + CP020000,
            NRG = CPGREN01,
            `Core inflation` = CPALTT01-FOOD-NRG) |>
  select(date, `Total inflation`, `Core inflation`) |>
  gather(Coicop, values, -date) |>
  mutate(Coicop = factor(Coicop, levels = c("Total inflation", "Core inflation")),
         Geo = "US")

bars_US <- PRICES_CPI |>
  filter(MEASURE == "CTGY",
         LOCATION %in% c("USA")) |>
  #filter(obsTime == "2023-09") %>%
  filter(SUBJECT %in% c("CPGRLE01", "CPGREN01", "CP010000", "CP020000",
                        "CPALTT01", "CP040100", "CP040200")) |>
  month_to_date() |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, obsValue, SUBJECT) |>
  spread(SUBJECT, obsValue) |>
  transmute(date,
            FOOD = CP010000 + CP020000,
            NRG = CPGREN01,
            RENTS = CP040100+CP040200,
            TOT_X_NRG_FOOD_RENTS = CPALTT01-FOOD-NRG-RENTS) |>
  gather(coicop, values, -date) |>
  # CP070200, CP040500, CP010000
  # CPGRSE01, CPGRGO01
  mutate(Coicop = factor(coicop, levels = c("FOOD", "NRG", "RENTS", "TOT_X_NRG_FOOD_RENTS"),
                         labels = c("Food", "Energy", "Rents",
                                    "Total less Energy, Food and Rents")),
         Geo = "US")

bars_US |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_US, aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions to inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2))

E.U.

Code
load_data("eurostat/prc_hicp_ctrb.RData")
line_EU <- prc_hicp_ctrb |>
  filter(coicop %in% c("NRG", "FOOD", "CP01", "CP02", "CP03", "CP04", "CP05", "CP06",
                       "CP07", "CP08", "CP09", "CP10", "CP11", "CP12", "CP041")) %>%
  mutate(date = gsub("M", "-", time) |> paste0("-01") |> as.Date()) |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, values, coicop) |>
  spread(coicop, values) |>
  transmute(date,
            `Total inflation` = CP01+CP02+CP03+CP04+CP05+CP06+CP07+CP08+CP09+CP10+CP11+CP12,
            FOOD,
            NRG,
            `Core inflation` = `Total inflation`-FOOD-NRG) |>
  select(date, `Total inflation`, `Core inflation`) |>
  gather(Coicop, values, -date) |>
  mutate(Coicop = factor(Coicop, levels = c("Total inflation", "Core inflation")),
         Geo = "Euro area")

bars_EU <- prc_hicp_ctrb |>
  filter(coicop %in% c("NRG", "FOOD", "CP01", "CP02", "CP03", "CP04", "CP05", "CP06",
                       "CP07", "CP08", "CP09", "CP10", "CP11", "CP12", "CP041")) %>%
  mutate(date = gsub("M", "-", time) |> paste0("-01") |> as.Date()) |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, values, coicop) |>
  spread(coicop, values) |>
  transmute(date,
            FOOD,
            NRG,
            RENTS = CP041,
            `Total inflation` = CP01+CP02+CP03+CP04+CP05+CP06+CP07+CP08+CP09+CP10+CP11+CP12,
            TOT_X_NRG_FOOD_RENTS = `Total inflation`-FOOD-NRG-RENTS) |>
  select(-`Total inflation`) |>
  gather(coicop, values, -date) |>
  # CP070200, CP040500, CP010000
  # CPGRSE01, CPGRGO01
  mutate(Coicop = factor(coicop, levels = c("FOOD", "NRG", "RENTS", "TOT_X_NRG_FOOD_RENTS"),
                         labels = c("Food", "Energy", "Rents",
                                    "Total less Energy, Food and Rents")),
         Geo = "Euro area")

bars_EU |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_EU, aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions to inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2))

US, E.U.

Code
bars_EU |>
  bind_rows(bars_US) |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_EU |> bind_rows(line_US), aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions to inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2)) +
  facet_wrap(~ Geo)

French

US

Code
Sys.setlocale("LC_TIME", "fr_CA.UTF-8")
# [1] "fr_CA.UTF-8"
Code
line_US <- PRICES_CPI |>
  filter(MEASURE == "CTGY",
         LOCATION %in% c("USA"),
         SUBJECT %in% c("CPALTT01", "CPGREN01", "CP010000", "CP020000")) |>
  month_to_date() |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, obsValue, SUBJECT) |>
  spread(SUBJECT, obsValue) |>
  transmute(date, `Total inflation` = CPALTT01,
            FOOD = CP010000 + CP020000,
            NRG = CPGREN01,
            `Core inflation` = CPALTT01-FOOD-NRG) |>
  select(date, Inflation = `Total inflation`, `Inflation sous-jacente` = `Core inflation`) |>
  gather(Coicop, values, -date) |>
  mutate(Coicop = factor(Coicop, levels = c("Inflation", "Inflation sous-jacente")),
         Geo = "États-Unis")

bars_US <- PRICES_CPI |>
  filter(MEASURE == "CTGY",
         LOCATION %in% c("USA")) |>
  #filter(obsTime == "2023-09") %>%
  filter(SUBJECT %in% c("CPGRLE01", "CPGREN01", "CP010000", "CP020000",
                        "CPALTT01", "CP040100", "CP040200")) |>
  month_to_date() |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, obsValue, SUBJECT) |>
  spread(SUBJECT, obsValue) |>
  transmute(date,
            FOOD = CP010000 + CP020000,
            NRG = CPGREN01,
            RENTS = CP040100+CP040200,
            TOT_X_NRG_FOOD_RENTS = CPALTT01-FOOD-NRG-RENTS) |>
  gather(coicop, values, -date) |>
  # CP070200, CP040500, CP010000
  # CPGRSE01, CPGRGO01
  mutate(Coicop = factor(coicop, levels = c("FOOD", "NRG", "RENTS", "TOT_X_NRG_FOOD_RENTS"),
                         labels = c("Alimentation", "Énergie", "Loyers",
                                    "Total sans énergie, alimentation, loyers")),
         Geo = "États-Unis")

bars_US |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_US, aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions à l'inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2))

E.U.

Code
Sys.setlocale("LC_TIME", "fr_CA.UTF-8")
# [1] "fr_CA.UTF-8"
Code
load_data("eurostat/prc_hicp_ctrb.RData")
line_EU <- prc_hicp_ctrb |>
  filter(coicop %in% c("NRG", "FOOD", "CP01", "CP02", "CP03", "CP04", "CP05", "CP06",
                       "CP07", "CP08", "CP09", "CP10", "CP11", "CP12", "CP041")) %>%
  mutate(date = gsub("M", "-", time) |> paste0("-01") |> as.Date()) |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, values, coicop) |>
  spread(coicop, values) |>
  transmute(date,
            `Total inflation` = CP01+CP02+CP03+CP04+CP05+CP06+CP07+CP08+CP09+CP10+CP11+CP12,
            FOOD,
            NRG,
            `Core inflation` = `Total inflation`-FOOD-NRG) |>
  select(date, Inflation = `Total inflation`, `Inflation sous-jacente` = `Core inflation`) |>
  gather(Coicop, values, -date) |>
  mutate(Coicop = factor(Coicop, levels = c("Inflation", "Inflation sous-jacente")),
         Geo = "Zone euro")

bars_EU <- prc_hicp_ctrb |>
  filter(coicop %in% c("NRG", "FOOD", "CP01", "CP02", "CP03", "CP04", "CP05", "CP06",
                       "CP07", "CP08", "CP09", "CP10", "CP11", "CP12", "CP041")) %>%
  mutate(date = gsub("M", "-", time) |> paste0("-01") |> as.Date()) |>
  filter(date >= as.Date("2020-01-01")) |>
  select(date, values, coicop) |>
  spread(coicop, values) |>
  transmute(date,
            FOOD,
            NRG,
            RENTS = CP041,
            `Total inflation` = CP01+CP02+CP03+CP04+CP05+CP06+CP07+CP08+CP09+CP10+CP11+CP12,
            TOT_X_NRG_FOOD_RENTS = `Total inflation`-FOOD-NRG-RENTS) |>
  select(-`Total inflation`) |>
  gather(coicop, values, -date) |>
  # CP070200, CP040500, CP010000
  # CPGRSE01, CPGRGO01
  mutate(Coicop = factor(coicop, levels = c("FOOD", "NRG", "RENTS", "TOT_X_NRG_FOOD_RENTS"),
                         labels = c("Alimentation", "Énergie", "Loyers",
                                    "Total sans énergie, alimentation, loyers")),
         Geo = "Zone euro")

bars_EU |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_EU, aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions à l'inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2))

US, E.U.

Code
bars_EU |>
  bind_rows(bars_US) |>
  mutate(Geo = factor(Geo, levels = c("Zone euro", "États-Unis"))) |>
  ggplot(aes(x = date, y = values/100)) +
  geom_col(aes(fill = Coicop), alpha = 1) +
  geom_line(data = line_EU |>
              bind_rows(line_US) |>
              mutate(Geo = factor(Geo, levels = c("Zone euro", "États-Unis"))),
            aes(linetype = Coicop), size = 1.2) +
  theme_minimal() + xlab("") + ylab("Contributions à l'inflation") +
  scale_fill_manual(values = c("forestgreen","orange", "grey", "blue")) +
  scale_x_date(breaks ="3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-10, 30, 1),
                     labels = percent_format(accuracy = 1)) +
  theme(legend.position = "top",
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  guides(fill=guide_legend(nrow=2)) +
  facet_wrap(~ Geo)

Price index - IXOB

CPI and HICP

France vs. Germany

1996-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  filter(date >= as.Date("1996-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  group_by(LOCATION, Subject) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("Price Index") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_log10(breaks = seq(10, 200, 5))

1999-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  filter(date >= as.Date("1999-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  group_by(LOCATION, Subject) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("Price Index") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_log10(breaks = seq(10, 200, 5))

2008-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  filter(date >= as.Date("2008-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  group_by(LOCATION, Subject) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("Price Index") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_log10(breaks = seq(10, 200, 5))

2015-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  filter(date >= as.Date("2015-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  group_by(LOCATION, Subject) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("Price Index") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_log10(breaks = seq(10, 200, 5))

2017-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  filter(date >= as.Date("2017-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  group_by(LOCATION, Subject) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("Price Index") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_log10(breaks = seq(10, 200, 5))

Total Inflation - GP - CPALTT01

Nobs - CPI

Code
PRICES_CPI |>
  filter(SUBJECT == "CPALTT01",
         MEASURE == "GP") |>
  group_by(LOCATION, FREQUENCY) |>
  summarise(Nobs = n()) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  spread(FREQUENCY, Nobs) |>
  arrange(-M) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Nobs - HICP

Code
PRICES_CPI |>
  filter(SUBJECT == "CPHPTT01",
         MEASURE == "GY") |>
  group_by(LOCATION, FREQUENCY) |>
  summarise(Nobs = n()) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  spread(FREQUENCY, Nobs) |>
  arrange(-M) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Largest obs

Code
PRICES_CPI |>
  filter(SUBJECT == "CPALTT01",
         MEASURE == "GP") |>
  filter(obsValue >= 10) |>
  arrange(-obsValue) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(obsTime, Location, FREQUENCY, obsValue) |>
  print_table_conditional()

South Korea

Annual

Code
PRICES_CPI |>
  filter(LOCATION %in% c("KOR"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue)) + 
  scale_color_identity() + 
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Poland, Hungary

Annual

Code
PRICES_CPI |>
  filter(LOCATION %in% c("POL", "HUN"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Quarterly

Code
PRICES_CPI |>
  filter(LOCATION %in% c("POL", "HUN"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

France, Italy, Germany, Canada

Annual

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "CAN"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Quarterly

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "CAN"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

France, Germany

Monthly

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location2, linetype = Location2)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) +
  add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation, Glissement sur un an (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.7, 0.9),
        legend.title = element_blank()) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

2015-

CPI
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= as.Date("2015-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location2)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) +
  add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation, Glissement sur un an (%)") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.2, 0.9),
        legend.title = element_blank()) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

CPI and HICP
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= as.Date("2015-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

2020-

CPI
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= as.Date("2020-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location2)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) +
  add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation, Glissement sur un an (%)") +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.2, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

CPI and HICP
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= as.Date("2020-01-01")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, size = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_size_manual(values = c(0.5, 1)) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(data = . %>%
                        filter(month(date) %in% c(1, 6)), aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

2 years

CPI
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_2flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.15, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

HICP
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_2flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.15, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

CPI and HICP
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.15, 0.8),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

1 year

CPI
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(1)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_2flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "1 month",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.8, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

CPI and HICP
Last year
Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPHPTT01", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, SUBJECT, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(1)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(Location2 = ifelse(LOCATION == "DEU", "Allemagne", Location)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = Location, linetype = Subject)) + 
  scale_color_manual(values = c("#000000", "#ED2939")) +
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_x_date(breaks = "1 month",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.8, 0.7),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

France, Germany, UNited States

2 years

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "USA"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  #mutate(color = ifelse(LOCATION == "DEU", color2, color)) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_linetype_manual(values = c("dashed", "solid")) + add_3flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_color_identity() +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.1, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

France, Germany, UNited States, Europe

CPALTT01 - All items

2 years

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "USA", "EA20"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  mutate(Location = ifelse(LOCATION == "EA20", "Europe", Location)) |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "EA20", color2, color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_color_identity() +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.1, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

1 year

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "USA", "EA20"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(1)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  mutate(Location = ifelse(LOCATION == "EA20", "Europe", Location)) |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "EA20", color2, color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)") +
  scale_color_identity() +
  scale_x_date(breaks = "1 month",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.1, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

CPGRLE01 - CPI: All items non-food non-energy

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "USA", "EA20"),
         SUBJECT %in% c("CPGRLE01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  mutate(Location = ifelse(LOCATION == "EA20", "Europe", Location)) |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "EA20", color2, color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_linetype_manual(values = c("dashed", "solid")) + add_4flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)\nCPI: All items non-food non-energy") +
  scale_color_identity() +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.1, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

Housing - CPGRHO01

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "USA", "EA20"),
         SUBJECT %in% c("CPGRHO01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  filter(date >= Sys.Date() -years(2)) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  mutate(Location = ifelse(LOCATION == "EA20", "Europe", Location)) |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "EA20", color2, color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_linetype_manual(values = c("dashed", "solid")) + add_2flags +
  theme_minimal() + xlab("") + ylab("1 year inflation (%)\nCPI: All items non-food non-energy") +
  scale_color_identity() +
  scale_x_date(breaks = "2 months",
               labels = date_format("%b %Y")) +
  theme(legend.position = c(0.1, 0.9),
        legend.title = element_blank(),
        axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + 
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  geom_text_repel(aes(x = date, y = obsValue, label = percent(obsValue, acc = 0.1)), 
                  fontface ="plain", color = "black", size = 3)

France

Monthly

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue)) + 
  scale_color_identity() + 
  theme_minimal() + xlab("") + ylab("Inflation, Glissement sur un an (%)") +
  scale_x_date(breaks = seq(1960, 2100, 10) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Monthly

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

Spain, Greece, Belgium, Austria

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUT", "BEL", "GRC", "ESP"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Switzerland, South Korea, Finland, India

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE", "KOR", "FIN", "IND"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Switzerland, Germany

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Switzerland, Germany, US, France, Spain

Annual

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE", "DEU", "USA", "FRA", "ESP"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_5flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Monthly

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE", "DEU", "USA", "FRA", "ESP"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_5flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

2030-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE", "DEU", "USA", "FRA", "ESP"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "GY") |>
  month_to_date() |>
  filter(date >= as.Date("2030-01-01")) |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_5flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
  scale_x_date(breaks = "3 months",
               labels = date_format("%b %Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1))

US, U.K.

Code
PRICES_CPI |>
  filter(LOCATION %in% c("USA", "GBR"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(color = ifelse(LOCATION == "BEL", "#000000", color)) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Portugal, Sweden, Luxembourg, Norway

Code
PRICES_CPI |>
  filter(LOCATION %in% c("PRT", "SWE", "LUX", "NOR"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "GP") |>
  year_to_date() |>
  select(date, LOCATION, obsValue) |>
  mutate(obsValue = obsValue / 100) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Inflation (%)") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 2),
                     labels = percent_format(acc = 1))

Communication

Table

All

Code
PRICES_CPI |>
  filter(SUBJECT %in% c("CP080000"),
         FREQUENCY == "A",
         MEASURE == "IXOB") %>%
  select_if(~n_distinct(.) > 1) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  group_by(LOCATION, Location) |>
  arrange(obsTime) |>
  mutate(obsTime = as.numeric(obsTime)) |>
  summarise(obsTime_first = first(obsTime),
            obsTime_last = last(obsTime),
            obsValue_first = first(obsValue),
            obsValue_last = last(obsValue)) |>
  arrange(obsTime_first) |>
  print_table_conditional()

1990-

Code
PRICES_CPI |>
  filter(SUBJECT %in% c("CP080000"),
         FREQUENCY == "A",
         MEASURE == "IXOB",
         obsTime %in% c("1990", "2020")) %>%
  select_if(~n_distinct(.) > 1) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  spread(obsTime, obsValue) |>
  filter(!is.na(`1990`)) |>
  mutate(growth = 100*((`2020`/`1990`)^(1/30)-1)) |>
  arrange(growth) |>
  print_table_conditional()
LOCATION Location 1990 2020 growth
NOR Norway 260.15000 115.00000 -2.6843995
CHE Switzerland 180.84990 97.85236 -2.0265426
FRA France 158.38080 91.96333 -1.7957224
SWE Sweden 123.64790 76.65689 -1.5810301
KOR Korea 153.20270 95.22109 -1.5727032
JPN Japan 143.60830 91.08334 -1.5062559
IRL Ireland 120.98260 86.11549 -1.1267950
AUS Australia 92.06799 79.80943 -0.4751531
ISR Israel 74.58443 80.02937 0.2351491
GBR United Kingdom 104.20000 114.10000 0.3030019
PRT Portugal 80.20266 101.26370 0.7802661

Norway, Switzerland, France, Sweden, Korea

1990-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("NOR", "CHE", "FRA", "SWE", "KOR"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  filter(date >= as.Date("1990-01-01")) |>
  mutate(obsValue = 100*obsValue/obsValue[date == as.Date("1990-01-01")]) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_5flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Japan, Ireland, Australia, Iceland, UK

1990-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN", "IRL", "AUS", "ISR", "GBR"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  filter(date >= as.Date("1990-01-01")) |>
  mutate(obsValue = 100*obsValue/obsValue[date == as.Date("1990-01-01")]) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_5flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

France, US, Germany, Japan

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  mutate(obsValue = 100*obsValue/obsValue[date == as.Date("2010-01-01")]) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

France, Germany, Japan

1991-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU", "JPN"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  filter(date >= as.Date("1991-01-01")) |>
  mutate(obsValue = 100*obsValue/obsValue[date == as.Date("1991-01-01")]) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_3flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Korea, Canada, Portugal, Spain

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("KOR", "CAN", "PRT", "ESP"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

Denmark, Australia, Austria, Belgium

Code
PRICES_CPI |>
  filter(LOCATION %in% c("DNK", "AUS", "AUT", "BEL"),
         SUBJECT %in% c("CP080000", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP080000)) |>
  mutate(obsValue = 100*CP080000/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Communication") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  theme(legend.position = c(0.2, 0.80),
        legend.title = element_blank())

Rents relative to Price Index

Nobs

Code
PRICES_CPI |>
  filter(SUBJECT %in% c("CP040100"),
         MEASURE == "IXOB") |>
  group_by(LOCATION, FREQUENCY) |>
  summarise(Nobs = n()) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  spread(FREQUENCY, Nobs) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Table

Code
PRICES_CPI |>
  filter(SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "A",
         MEASURE == "IXOB",
         obsTime %in% c("1978", "1988", "1998", "2008", "2018")) |>
  select(SUBJECT, obsTime, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = round(100*CP040100/CPALTT01, 1)) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(LOCATION, Location, obsTime, rents_real) |>
  spread(obsTime, rents_real) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Weights - Housing

2017

Javascript

Code
PRICES_CPI |>
  filter(MEASURE == "AL",
         SUBJECT %in% c("PWCP0410", "PWCP0420", "PWCP0400"),
         obsTime %in% c("2017")) |>
  left_join(tibble(SUBJECT = c("PWCP0410", "PWCP0420", "PWCP0400"),
                   Subject = c("Rents (actual)", "Rents (imputed)", "Housing")),
            by = "SUBJECT") |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(Location, Subject, obsValue) |>
  mutate(obsValue = round(obsValue/10, 1)) |>
  spread(Subject, obsValue) |>
  mutate(`Rents (Total)` = `Rents (actual)` + ifelse(is.na(`Rents (imputed)`), 0, `Rents (imputed)`)) |>
  arrange(`Rents (Total)`) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

png

Code
i_g("bib/oecd/PRICES_CPI_ex3.png")

2019

Javascript

Code
PRICES_CPI |>
  filter(MEASURE == "AL",
         SUBJECT %in% c("PWCP0410", "PWCP0420", "PWCP0400"),
         obsTime %in% c("2019")) |>
  left_join(tibble(SUBJECT = c("PWCP0410", "PWCP0420", "PWCP0400"),
                   Subject = c("Rents (actual)", "Rents (imputed)", "Housing")),
            by = "SUBJECT") |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(Location, Subject, obsValue) |>
  mutate(obsValue = round(obsValue/10, 1)) |>
  spread(Subject, obsValue) |>
  mutate(`Rents (Total)` = `Rents (actual)` + ifelse(is.na(`Rents (imputed)`), 0, `Rents (imputed)`)) |>
  arrange(`Rents (Total)`) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

png

Code
i_g("bib/oecd/PRICES_CPI_ex2.png")

France, Italy, United States, Germany

CP01

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0100") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP02

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0200") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP08

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0800") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP04

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0400") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP041

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0410") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP042

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0420") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP03

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0300") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP05

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0500") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP06

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0600") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP07

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0700") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP09

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP0900") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP10

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP1000") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP11

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP1100") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

CP12

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "ITA", "DEU", "USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         SUBJECT == "PWCP1200") |>
  year_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  mutate(obsValue = obsValue/1000) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("Weights") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(0, 200, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

Weights - Countries

Israel

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         MEASURE == "AL",
         FREQUENCY == "A",
         obsTime %in% c("1994", "1999", "2009", "2019")) |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  select(SUBJECT, Subject, obsTime, obsValue) |>
  spread(obsTime, obsValue) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Switzerland

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         MEASURE == "AL",
         FREQUENCY == "A",
         obsTime %in% c("1994", "1999", "2009", "2019")) |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  select(SUBJECT, Subject, obsTime, obsValue) |>
  spread(obsTime, obsValue) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

France

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         obsTime %in% c("1994", "1999", "2009", "2019")) |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  select(SUBJECT, Subject, obsTime, obsValue) |>
  spread(obsTime, obsValue) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Australia

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUS"),
         MEASURE == "AL",
         FREQUENCY == "A",
         obsTime %in% c("1994", "1999", "2009", "2019")) |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  select(SUBJECT, Subject, obsTime, obsValue) |>
  spread(obsTime, obsValue) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

United States

Code
PRICES_CPI |>
  filter(LOCATION %in% c("USA"),
         MEASURE == "AL",
         FREQUENCY == "A",
         obsTime %in% c("1994", "1999", "2009", "2019")) |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  select(SUBJECT, Subject, obsTime, obsValue) |>
  spread(obsTime, obsValue) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Components - Quarterly

Israel

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(Nobs = n(),
            min = min(obsTime),
            max = max(obsTime)) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Switzerland

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(Nobs = n(),
            min = min(obsTime),
            max = max(obsTime)) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

France

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(Nobs = n(),
            min = min(obsTime),
            max = max(obsTime)) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

United States

Code
PRICES_CPI |>
  filter(LOCATION %in% c("USA"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$SUBJECT, by = "SUBJECT") |>
  group_by(SUBJECT, Subject) |>
  summarise(Nobs = n(),
            min = min(obsTime),
            max = max(obsTime)) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Inflation - CPI and Rents

Table

Code
PRICES_CPI |>
  filter(SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY",
         obsTime == "2019-Q4") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(LOCATION, Location, SUBJECT, obsValue) |>
  mutate(obsValue = round(obsValue, 1)) |>
  spread(SUBJECT, obsValue) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Location)),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Iceland

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISL"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value/100, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 5),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Japan

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value/100, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 5),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1985 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1985-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

Israel

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1993-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

United Kingdom

All -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

1993 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1993-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("2010-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

2012 - 2019

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("2014-01-01"),
         date <= as.Date("2030-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation (%)") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 0.5),
                     labels = percent_format(acc = .1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

Switzerland

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1970-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

United States

Code
PRICES_CPI |>
  filter(LOCATION %in% c("USA"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1970-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

France

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1970-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

Australia

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUS"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "GY") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100),
         date >= as.Date("1970-01-01")) |>
  mutate(rents_real = CP040100-CPALTT01) |>
  select(date, LOCATION, CPALTT01, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("Inflation") +
  geom_line(aes(x = date, y = value/100, color = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 200, 1),
                     labels = percent_format(acc = 1)) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.9, 0.9),
        legend.title = element_blank())

CPI, Rents, Real Rents

Iceland

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISL"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2007-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISL"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2007-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(CP040100 = 100*CP040100/CP040100[date == as.Date("2007-01-01")],
         CPALTT01 = 100*CPALTT01/CPALTT01[date == as.Date("2007-01-01")],
         rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 20)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.2, 0.8),
        legend.title = element_blank())

Japan

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1980-1995

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01"),
         date <= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.8, 0.8),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  filter(date >= as.Date("2010-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

United Kingdom

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("GBR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Israel

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("ISR"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  filter(date >= as.Date("2010-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Switzerland

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("CHE"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  month_to_date() |>
  filter(date >= as.Date("2010-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

France

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2010-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Australia

1980 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUS"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1980-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2000 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUS"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

2010 -

Code
PRICES_CPI |>
  filter(LOCATION %in% c("AUS"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2010-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(rents_real = 100*CP040100/CPALTT01) |>
  select(date, LOCATION, CPALTT01, rents_real, CP040100) |>
  gather(variable, value, - date, -LOCATION) |>
  mutate(Variable = case_when(variable == "rents_real" ~ "Real Rents",
                              variable == "CP040100" ~ "Rents",
                              variable == "CPALTT01" ~ "CPI")) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  ggplot() + theme_minimal() + xlab("") + ylab("CPI") +
  geom_line(aes(x = date, y = value, color = Variable, linetype = Variable)) +
  scale_x_date(breaks = seq(1960, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Real Rents

France, Germany, Japan, United States

All

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(obsValue = 100*CP040100/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

After 1990

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("1990-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(obsValue = 100*CP040100/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

After 2000

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  filter(date >= as.Date("2000-01-01")) |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(obsValue = 100*CP040100/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 1)) +
  theme(legend.position = c(0.15, 0.5),
        legend.title = element_blank())

Korea, Canada, Portugal, Spain

Code
PRICES_CPI |>
  filter(LOCATION %in% c("KOR", "CAN", "PRT", "ESP"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(obsValue = 100*CP040100/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.80),
        legend.title = element_blank())

Denmark, Australia, Austria, Belgium

Code
PRICES_CPI |>
  filter(LOCATION %in% c("DNK", "AUS", "AUT", "BEL"),
         SUBJECT %in% c("CP040100", "CPALTT01"),
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  select(SUBJECT, date, LOCATION, obsValue) |>
  spread(SUBJECT, obsValue) |>
  filter(!is.na(CP040100)) |>
  mutate(obsValue = 100*CP040100/CPALTT01) |>
  group_by(LOCATION) |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Real Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 5)) +
  theme(legend.position = c(0.2, 0.80),
        legend.title = element_blank())

France, United States, Germany, Japan

CPI, All Items

All

Code
PRICES_CPI_CPALTT01_IXOB <- PRICES_CPI |>
  filter(SUBJECT == "CPALTT01",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(LOCATION, Location, obsTime, CPALTT01_IXOB = obsValue)

save(PRICES_CPI_CPALTT01_IXOB, file = "PRICES_CPI_CPALTT01_IXOB_2.RData")

PRICES_CPI_CPALTT01_IXOB <- PRICES_CPI |>
  filter(SUBJECT == "CPALTT01",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  select(LOCATION, Location, date, CPALTT01_IXOB = obsValue)

save(PRICES_CPI_CPALTT01_IXOB, file = "PRICES_CPI_CPALTT01_IXOB.RData")

PRICES_CPI_CPALTT01_IXOB |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  rename(obsValue = CPALTT01_IXOB) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1990-

Code
PRICES_CPI_CPALTT01_IXOB |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         date >= as.Date("1990-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  rename(obsValue = CPALTT01_IXOB) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1996-

Code
PRICES_CPI_CPALTT01_IXOB |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         date >= as.Date("1996-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  rename(obsValue = CPALTT01_IXOB) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Services less housing

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT == "CPGRLH01",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags + theme_minimal() +
  theme_minimal() + xlab("") + ylab("Services less housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Food and non-Alcoholic beverages

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT == "CP010000",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags +
  theme_minimal() + xlab("") + ylab("CPI, Food and non-Alcoholic beverages") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Clothing and Footware

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT == "CP030000",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() +
  theme_minimal() + xlab("") + ylab("CPI, Clothing and Footware") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Restaurants and hotels

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT == "CP110000",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() +
  theme_minimal() + xlab("") + ylab("CPI,  Restaurants and hotels") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

Actual rentals for housing

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "USA", "DEU", "JPN"),
         SUBJECT == "CP040100",
         FREQUENCY == "Q",
         MEASURE == "IXOB") |>
  quarter_to_date() |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  left_join(colors, by = c("Location"  = "country")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_4flags + theme_minimal() +
  theme_minimal() + xlab("") + ylab("CPI, Actual rentals for housing") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10))

France, Germany

Monthly

1990-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  month_to_date() |>
  filter(date >= as.Date("1990-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1996-

Code
PRICES_CPI |>
  filter(LOCATION %in% c("FRA", "DEU"),
         SUBJECT %in% c("CPALTT01"),
         FREQUENCY == "M",
         MEASURE == "IXOB") |>
  left_join(PRICES_CPI_var$LOCATION, by = "LOCATION") |>
  month_to_date() |>
  filter(date >= as.Date("1996-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

Quarterly

1990-

Code
PRICES_CPI_CPALTT01_IXOB |>
  filter(LOCATION %in% c("FRA", "DEU"),
         date >= as.Date("1990-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  rename(obsValue = CPALTT01_IXOB) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())

1996-

Code
PRICES_CPI_CPALTT01_IXOB |>
  filter(LOCATION %in% c("FRA", "DEU"),
         date >= as.Date("1996-01-01")) |>
  left_join(colors, by = c("Location"  = "country")) |>
  rename(obsValue = CPALTT01_IXOB) |>
  group_by(Location) |>
  mutate(obsValue = 100*obsValue/obsValue[1]) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  scale_color_identity() + add_2flags + theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1960, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 400, 10)) +
  theme(legend.position = c(0.7, 0.30),
        legend.title = element_blank())