ExportGenius Trade Analysis: Russia

Author

Gagan Atreya

Published

July 24, 2024

Section 1. Gold

Code
rm(list = ls())

pacman::p_load(readxl, vtable, tidyverse, 
               lubridate, data.table, zoo, 
               readODS, patchwork)

df <- fread("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_price/goldprice.csv")

ggplot(df, 
       aes(x = date, 
           y = price_gram)) +
  geom_line() + 
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  labs(title = "International gold price per gram", 
       x = "Date", 
       y = "Price (USD)", 
       caption = "Source: macrotrends & auronum.co.uk") +  
  theme_minimal()  

1.1 Gold exports

Code
rm(list = ls())

df <- fread("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_rus/Russia-DetailedExport-Gold.csv")

df$date <- dmy(df$Date)

df$description <- df$`Product Description`
df$destination_country <- df$`Destination Country`
df$exporter <- df$Exporter
df$buyer <- df$Buyer
df$total_value <- df$`Total Value USD`
df$price_invoice <- df$total_value/df$Quantity

df <- df[, c("date", "description", "destination_country",
             "exporter", "buyer", "price_invoice", "total_value")]

df02 <- fread("~/Desktop/soc_ace_2024/scripts/exportgenius/gold_analyses_latest/goldprice.csv")
# head(df02$date)
df02$date <- ymd(df02$date)
df <- merge(df, df02, by = "date")
df$price_benchmark <- df$price_gram

plot01 <- ggplot(df, 
                 aes(x = date, 
                     y = total_value)) +
  geom_line() +
  geom_point() +  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  # ylim(15, 120) +
  labs(title = "Russia Gold Exports", 
       x = "Date", 
       y = "Total Value") +  
  theme_bw() 

plot01

Code
plot02 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value, 
              color = destination_country))+
  geom_line()+ 
  geom_point()+
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  labs(title = "Russia Gold Exports", 
       y = "Total value", 
       x = "Date")+
  theme_bw()

plot02

Code
plot03 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~destination_country, ncol = 2)+
  labs(title = "Russia Gold Exports by Destination", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03

Code
plot03a <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~exporter, ncol = 2)+
  labs(title = "Russia Gold Exports by Exporter", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03a

Code
plot03b <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~buyer, ncol = 2)+
  labs(title = "Russia Gold Exports by Buyer", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03b

Code
max_price_index <- which.max(df$price_invoice)

# Remove the row with the highest value in the 'price' column
df <- df[-max_price_index, ]
df$filter01 <- ifelse(df$price_invoice > 150, 1, 0)
#table(df$filter01)
df <- df[df$price_invoice <=120, ]
df$price_difference <- df$price_invoice - df$price_benchmark

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df_long <- reshape2::melt(df03, 
                          id.vars = "date", 
                          variable.name = "price_type", 
                          value.name = "price")

ggplot(df_long, 
       aes(x = date, 
           y = price, 
           linetype = price_type)) +
  geom_line(size = 0.75, 
            color = "black")+  
  labs(title = "Russia Gold Imports", 
       x = "Date", 
       y = "Price") +  
  theme_bw() 

Code
#df <- df[df$Origin_Country == "China", ]

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df$price_difference <- scale(df$price_invoice - df$price_benchmark)

plot04 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Exports: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) 

plot04

Code
plot05 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Exports by Destination: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~destination_country, 
             ncol = 2)

plot05

Code
plot06 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Exports by Exporter: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~exporter, 
             ncol = 2)

plot06

Code
plot07 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Exports by Buyer: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~buyer, 
             ncol = 3)

plot07

1.2 Gold imports

Code
rm(list = ls())

df <- read_ods("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_rus/Russia-DetailedImport-Gold.ods")

df$date <- dmy(df$Date)

df$date <- df$date
df$description <- df$Product_Description
df$origin_country <- df$Origin_Country
df$supplier <- df$Supplier
df$importer <- df$Importer
df$price_invoice <- df$Total_Value/df$Quantity
df$total_value <- df$Total_Value

df <- df[, c("date", "description", "origin_country",
             "supplier", "importer", "price_invoice", "total_value")]

df100 <- read_ods("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_rus/Russia-MirrorImport-Gold.ods")

df100$date <- dmy(df100$Date)
df100$description <- df100$Product_Description
df100$origin_country <- df100$Origin_Country
df100$supplier <- df100$Supplier
df100$importer <- df100$Importer
df100$total_value <- (df100$Total_Value)
df100$price_invoice <- df100$total_value/df100$Quantity

df100 <- df100[, c("date", "description", "origin_country",
                   "supplier", "importer", "price_invoice", "total_value")]


df <- rbind(df, df100)

df02 <- fread("~/Desktop/soc_ace_2024/scripts/exportgenius/gold_analyses_latest/goldprice.csv")
df02$date <- ymd(df02$date)
df <- merge(df, df02, by = "date")
df$price_benchmark <- df$price_gram

#df[sapply(df, is.infinite)] <- NA

df <- df[!(df$price_invoice > 1000),]

plot01 <- ggplot(df, 
                 aes(x = date, 
                     y = total_value)) +
  geom_line() +
  geom_point() +  
  # ylim(15, 120) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  labs(title = "Russia Gold Imports", 
       x = "Date", 
       y = "Total Value") +  
  theme_bw() 

plot01

Code
plot02 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value, 
              color = origin_country))+
  geom_line()+ 
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  
  geom_point()+
  labs(title = "Russia Gold Imports", 
       x = "Date", 
       y = "Total value")+
  theme_bw()

plot02

Code
plot03 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+   
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~origin_country, ncol = 2)+
  labs(title = "Russia Gold Imports by Origin", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03

Code
max_price_index <- which.max(df$price_invoice)
# Remove the row with the highest value in the 'price' column
df <- df[-max_price_index, ]
df$filter01 <- ifelse(df$price_invoice > 150, 1, 0)
# table(df$filter01)
df <- df[df$price_invoice <=120, ]
df$price_difference <- df$price_invoice - df$price_benchmark

#df <- df[df$Origin_Country == "China", ]

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df_long <- reshape2::melt(df03, 
                          id.vars = "date", 
                          variable.name = "price_type", 
                          value.name = "price")

ggplot(df_long, 
       aes(x = date, 
           y = price, 
           linetype = price_type)) +
  geom_line(size = 0.75, 
            color = "black")+  
  labs(title = "Russia Gold Imports", 
       x = "Date", 
       y = "Price") +  
  theme_bw() 

Code
df$price_difference <- df$price_invoice - df$price_benchmark

df$price_difference2 <- scale(df$price_difference)
df$price_benchmark2 <- scale(df$price_benchmark)

plot04 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Imports: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) 


plot04

Code
plot05 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Imports by Origin: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~origin_country, 
             ncol = 2)

plot05

Code
plot06 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Imports by Importer: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~importer, 
             ncol = 4)

plot06

Code
plot07 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Gold Imports by Supplier: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~supplier, 
             ncol = 5)

plot07

Section 2. Tobacco

2.1 Tobacco exports

Code
rm(list = ls())

df <- fread("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_rus/Russia-DetailedExport-Tobacco.csv")
df$date <- dmy(df$Date)

df$description <- df$`Product Description`
df$destination_country <- df$`Destination Country`
df$exporter <- df$Exporter
df$buyer <- df$Buyer
df$total_value <- df$`Total Value USD`
df$price_invoice <- df$total_value/df$Quantity

df <- df[, c("date", "description", "destination_country",
             "exporter", "buyer", "price_invoice", "total_value")]

df02 <- fread("~/Desktop/soc_ace_2024/scripts/exportgenius/gold_analyses_latest/goldprice.csv")
# head(df02$date)
df02$date <- ymd(df02$date)
df <- merge(df, df02, by = "date")
df$price_benchmark <- df$price_gram

plot01 <- ggplot(df, 
                 aes(x = date, 
                     y = total_value)) +
  geom_line() +
  geom_point() +  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  # ylim(15, 120) +
  labs(title = "Russia Tobacco Exports", 
       x = "Date", 
       y = "Total Value") +  
  theme_bw() 

plot01

Code
plot02 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value, 
              color = destination_country))+
  geom_line()+ 
  geom_point()+
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  labs(title = "Russia Tobacco Exports", 
       y = "Total value", 
       x = "Date")+
  theme_bw()

plot02

Code
plot03 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~destination_country, ncol = 2)+
  labs(title = "Russia Tobacco Exports by Destination", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03

Code
plot03a <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~exporter, ncol = 2)+
  labs(title = "Russia Tobacco Exports by Exporter", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03a

Code
plot03b <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+  
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~buyer, ncol = 2)+
  labs(title = "Russia Tobacco Exports by Buyer", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03b

Code
max_price_index <- which.max(df$price_invoice)

# Remove the row with the highest value in the 'price' column
df <- df[-max_price_index, ]
df$filter01 <- ifelse(df$price_invoice > 150, 1, 0)
#table(df$filter01)
df <- df[df$price_invoice <=120, ]
df$price_difference <- df$price_invoice - df$price_benchmark

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df_long <- reshape2::melt(df03, 
                          id.vars = "date", 
                          variable.name = "price_type", 
                          value.name = "price")

ggplot(df_long, 
       aes(x = date, 
           y = price, 
           linetype = price_type)) +
  geom_line(size = 0.75, 
            color = "black")+  
  labs(title = "Russia Tobacco Imports", 
       x = "Date", 
       y = "Price") +  
  theme_bw() 

Code
#df <- df[df$Origin_Country == "China", ]

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df$price_difference <- scale(df$price_invoice - df$price_benchmark)

plot04 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Exports: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) 

plot04

Code
plot05 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Exports by Destination: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~destination_country, 
             ncol = 2)

plot05

Code
plot06 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Exports by Exporter: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~exporter, 
             ncol = 2)

plot06

Code
plot07 <- ggplot(df, aes(x = date, 
                         y = price_difference)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference, 
                   color = price_difference > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Exports by Buyer: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~buyer, 
             ncol = 3)

plot07

2.2 Tobacco imports

Code
rm(list = ls())

pacman::p_load(readxl, vtable, tidyverse, 
               lubridate, data.table, zoo, 
               readODS, patchwork)


rm(list = ls())

df <- fread("/home/gagan/Desktop/soc_ace_2024/data/exportgenius/gold_rus/Russia-DetailedImport-Tobacco.csv")

df$date <- dmy(df$Date)

df$date <- df$date
df$description <- df$`Product Description`
df$origin_country <- df$`Origin Country`
df$supplier <- df$Supplier
df$importer <- df$Importer
df$price_invoice <- df$`Total Value USD`/df$Quantity
df$total_value <- df$`Total Value USD`

df <- df[, c("date", "description", "origin_country",
             "supplier", "importer", "price_invoice", "total_value")]

df02 <- fread("~/Desktop/soc_ace_2024/scripts/exportgenius/gold_analyses_latest/goldprice.csv")
df02$date <- ymd(df02$date)
df <- merge(df, df02, by = "date")
df$price_benchmark <- df$price_gram

#df[sapply(df, is.infinite)] <- NA

df <- df[!(df$price_invoice > 1000),]

plot01 <- ggplot(df, 
                 aes(x = date, 
                     y = total_value)) +
  geom_line() +
  geom_point() +  
  # ylim(15, 120) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  labs(title = "Russia Tobacco Imports", 
       x = "Date", 
       y = "Total Value") +  
  theme_bw() 

plot01

Code
plot02 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value, 
              color = origin_country))+
  geom_line()+ 
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  
  geom_point()+
  labs(title = "Russia Tobacco Imports", 
       x = "Date", 
       y = "Total value")+
  theme_bw()

plot02

Code
plot03 <- df %>% 
  ggplot( aes(x = date, 
              y = total_value)) +
  geom_line()+ 
  geom_point()+   
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  facet_wrap(~origin_country, ncol = 2)+
  labs(title = "Russia Tobacco Imports by Origin", 
       x = "Date", 
       y = "Total Value") +
  theme_bw()

plot03

Code
max_price_index <- which.max(df$price_invoice)
# Remove the row with the highest value in the 'price' column
df <- df[-max_price_index, ]
df$filter01 <- ifelse(df$price_invoice > 150, 1, 0)
# table(df$filter01)
df <- df[df$price_invoice <=120, ]
df$price_difference <- df$price_invoice - df$price_benchmark

#df <- df[df$Origin_Country == "China", ]

df03 <- df[, c("date", "price_invoice", "price_benchmark")]

df_long <- reshape2::melt(df03, 
                          id.vars = "date", 
                          variable.name = "price_type", 
                          value.name = "price")

ggplot(df_long, 
       aes(x = date, 
           y = price, 
           linetype = price_type)) +
  geom_line(size = 0.75, 
            color = "black")+  
  labs(title = "Russia Tobacco Imports", 
       x = "Date", 
       y = "Price") +  
  theme_bw() 

Code
df$price_difference <- df$price_invoice - df$price_benchmark

df$price_difference2 <- scale(df$price_difference)
df$price_benchmark2 <- scale(df$price_benchmark)

plot04 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Imports: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) 


plot04

Code
plot05 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Imports by Origin: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~origin_country, 
             ncol = 2)

plot05

Code
plot06 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Imports by Importer: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~importer, 
             ncol = 4)

plot06

Code
plot07 <- ggplot(df, aes(x = date, 
                         y = price_difference2)) +
  geom_segment(aes(x = date, 
                   xend = date, 
                   y = 0, 
                   yend = price_difference2, 
                   color = price_difference2 > 0)) +
  geom_point(color = "black", size = 2) +
  geom_vline(xintercept = as.Date("2022-02-24"), 
             linetype = "dashed", 
             color = "black", 
             size = 0.45) +
  theme_bw() +
  scale_color_manual(values = c("red", "blue")) +
  labs(title = "Russia Tobacco Imports by Supplier: Price Differentials Over Time",
       x = "Date",
       y = "Price differential (standardized)") +
  guides(color = FALSE) +
  facet_wrap(~supplier, 
             ncol = 5)
plot07