A. Data Summary of Food Prices for Turkey

Food Prices data for Turkey contains main food prices data comes from the World Food Programme (WFP) and covers 52 different kinds of foods within 8 main categories. The data is basically categorized into food category, market, years and units.

Manipulation and the process of the data performed in the initial analysis. All the steps and detailed dimensions of the data can be found in our initial analysis document.

# Reading organized ".rds" file from GPJ 
# Create a temporary file
tmp=tempfile(fileext=".rds")
# Download file from repository to the temp file
download.file("https://github.com/MEF-BDA503/gpj18-data-r-sizlari/blob/master/wfp_food_prices_turkey.rds?raw=true",destfile=tmp,mode='wb')
# Read that rds file.
refined_data=read_rds(tmp)
# Remove the temp file
file.remove(tmp)
## [1] TRUE
head(refined_data)
##         date          name unit               type  value currency
## 1 2013-05-15 Rice - Retail   KG cereals and tubers 4.4920      TRY
## 2 2013-06-15 Rice - Retail   KG cereals and tubers 4.5786      TRY
## 3 2013-11-15 Rice - Retail   KG cereals and tubers 4.7865      TRY
## 4 2013-12-15 Rice - Retail   KG cereals and tubers 5.1337      TRY
## 5 2014-01-15 Rice - Retail   KG cereals and tubers 5.5099      TRY
## 6 2014-02-15 Rice - Retail   KG cereals and tubers 5.8146      TRY
##             market year month
## 1 National Average 2013     5
## 2 National Average 2013     6
## 3 National Average 2013    11
## 4 National Average 2013    12
## 5 National Average 2014     1
## 6 National Average 2014     2

B. Exploratory Analysis

Yearly Average Price per Category

To have a general look at category and their yearly price developments, we checked the average prices per food type.

This graph shows that 2018 prices have increased in all categories. “milk and dairy” is the first type of foods that had significant price changes, followed by “meat, fish and eggs”.

refined_data %>% 
    filter(market=="National Average") %>%
    group_by(type, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = type, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = type, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price per Category") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

After a general summary, we want to deep dive into category details and food price developments in each category.

1. Yearly Average Price for Cereals and Tubers

According to Yearly Average Price for Cereals and Tubers graph, bread and rice have significant increase in price for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="cereals and tubers") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Cereals and Tubers") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included a trend graph for bread and rice.

Bread

Fluctuation in exchange rates increased the unit prices of flour. Increase in flour prices and other cost items caused bread prices to go up in 2018. Related news about the prices can be found in the following link.

Rice

Adverse weather conditions especially in US & EU caused rice prices to increase in 2018. According to TAGEM report, rice supply would be lower than 2017 due to the negative effects of the weather conditions. Related news about the prices can be found in the following link.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Bread (common) - Retail" | name=="Rice - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text( angle = 0, size = 10)) 

2. Yearly Average Price for Meat, Fish and Eggs

According to Yearly Average Price for Meat, Fish and Eggs graph, fresh fish and meat(mutton) have significant price increase for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="meat, fish and eggs") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Meat, Fish and Eggs") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included trend graph for fish (fresh) and meat (mutton).

Fish (fresh) & Meat (mutton)

Due to the increase in meat and chicken prices based on the currency crisis, people went for fish instead of meat & chicken. However, negative weather conditions affected the fish supply which cannot meet the higher demand for it. That’s why there is a boost in fish prices accordingly. Related news about the prices can be found in the following link.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Fish (fresh) - Retail" | name=="Meat (mutton) - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text(angle = 0, size = 10)) 

3. Yearly Average Price for Milk and Dairy

According to Yearly Average Price for Milk and Diary graph, Milk (powder, infant formula) has a notable increase in price for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="milk and dairy") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Milk and Dairy") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included trend graph for milk (powder, infant formula).

Milk (powder, infant formula)

Infant food prices have risen significantly in the last year. Pharmacists explained the reason of this increase as baby food is not paid by the Social Security Institution (SGK), the pricing decision is left to the mercy of private companies which leaded to unreasonable prices in baby foods. Related news about the prices can be found in the following link.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Milk (powder, infant formula) - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text(angle = 0, size = 10)) 

4. Yearly Average Price for Miscellaneous Food

According to Yearly Average Price for Miscellaneous Food graph, Cocoa and Coffee(Instant) have a significant price increase for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="miscellaneous food") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Miscellaneous Food") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included trend graph for cocoa and coffee (instant).

Cocoa

The future of cocoa is said to be under threat due to more than several reasons from global warming to pest. These factors can be summarized in 5 main headings: 1. Increasing demand 2. Decreasing supply - According to cocoa activists, only 6.6 percent profit remains for cocoa farmers. What makes the situation worse is that young people are turning to more profitable sectors. Today, the average age of cocoa makers is 51 and young people are not interested in cocoa plantation. 3. A difficult crop - Cocoa tree (theobroma cacao) is a tropical plant. It can only grow in humid, regular precipitation climates with low dry periods. This explains why it can only be produced in a narrow lane between 10 degrees north and 10 degrees south of the equator. Since the seeds in the same tree do not mature at the same time, it is necessary to constantly observe the trees. According to Make Chocolate Fair NGO, only half a kilo of cocoa can be obtained from fruit of a tree within a year. 4. Very sensitive to climate changes 5. Environmental threats such as insects, fungi, etc.

Related news about the cacao prices can be found in the following link..

Coffee (instant)

In 2015, coffee prices had a notable decrease in the world despite of the increasing demand of the emerging markets. Details of this issue can be found in the following link. Additionally, coffee plants are exposed to climate change impacts such as drought, excessive rainfall and pest infestation all over the world which also affects instant coffee prices in Turkey. link.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Cocoa (powder) - Retail" | name=="Coffee (instant) - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text( size = 10)) 

5. Yearly Average Price for Oil and Fats

According to Yearly Average Price for Oil and Fats graph, Olive oil have a significant price increase for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="oil and fats") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Oil and Fats") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included trend graph for olive oil.

Oil (olive) Subsequently in 2015 and 2016, olive oil prices have notably increased due to climate changes. Reports states that climate change worldwide leaded to downfall in yield of crops and that inevitably resulted in increase in the prices. Related news about the prices can be found in the following link.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Oil (olive) - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text( size = 10)) 

6. Yearly Average Price for Pulses and Nuts

According to Yearly Average Price for Pulses and Nuts graph, Groundnuts have a significant price increase for 2018.

    refined_data %>%
    filter(market=="National Average" & type=="pulses and nuts") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Pulses and Nuts") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

For a better understanding, we also included trend graph for groundnuts.

Groundnuts

As it can be seen in the graph, there are two major boosts in groundnut prices. In 2015, the reason was the lack of production and merchants were not able to satisfy the demand. Therefore, prices went up dramatically. Related news about the prices can be found in the following link.

In 2018, like almost every other product, groundnut prices significantly increased due to the economic crisis.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Groundnuts (shelled) - Retail")  %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text(size = 10)) 

7. Yearly Average Price for Vegetables and Fruits

According to Yearly Average Price for Vegetables and Fruits graph, cucumbers, eggplants and onions have significant price increase for 2018.

    refined_data %>% 
    filter(market=="National Average" & type=="vegetables and fruits") %>%
    group_by(name, year) %>%
    summarise(yearly_average_price=mean(value)) %>%
    ggplot(data = ., aes(x = name, y = yearly_average_price, 
    fill = as.character(year))) + geom_bar(stat = "identity", position=position_dodge()) + aes(x = name, 
    y =   yearly_average_price) + labs(x = "", y = "", title = "Yearly Average Price for Vegetables and Fruits") + theme_bw() + theme( axis.text.x = element_text(angle = 65, 
    vjust = 0.5, hjust = 0.5, size = 12)) + scale_y_continuous(labels = scales::comma) +   guides(fill=guide_legend(title="Year"))

The products with maximum price change in vegetables and fruits

We were interested in yearly average price changes per food, so we added YoY_growth column and sorted the data according to YoY_growth to see the highest price changes in vegetables and fruits and took top 3 for detailed analysis.

price_change = refined_data %>%
  filter(market=="National Average" & type=="vegetables and fruits")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth))
price_change
## # A tibble: 63 x 4
## # Groups:   name [14]
##    name                             year yearly_average_price YoY_growth
##    <fct>                           <dbl>                <dbl>      <dbl>
##  1 Eggplants - Retail               2017                 5.47      1.14 
##  2 Onions - Retail                  2018                 2.23      1.07 
##  3 Cucumbers (greenhouse) - Retail  2017                 4.38      0.904
##  4 Oranges - Retail                 2018                 2.70      0.655
##  5 Bananas - Retail                 2018                 8.54      0.422
##  6 Tomatoes - Retail                2018                 3.38      0.362
##  7 Garlic - Retail                  2016                14.9       0.357
##  8 Eggplants - Retail               2016                 2.55      0.330
##  9 Cauliflower - Retail             2015                 2.77      0.302
## 10 Tomatoes - Retail                2017                 2.48      0.296
## # ... with 53 more rows

For a better understanding, we also included trend graph for cucumbers, eggplants and onions.

Onions

Natural disasters such as heavy floods, floods and frosts caused onion prices to increase in 2018.
The stockists are also responsible for the rising prices as well as natural disasters. The products that could not be collected from damaged fields and their low yield increased the price of onions heavily. Related news about the onions prices can be found in the following link.

Cucumbers (greenhouse) & Eggplants

According to DHA, the yields of Mersin and Antalya’s greenhouses from where Turkey meets the needs of the fruits and vegetables during winter significantly reduced because of the cold weather that is higher than the seasonal norms. Due to the negative effects of cold weather as well as intense export season in this period, the prices of some products in the domestic market including cucumber & eggplants have exceeded the seasonal norms. Related news about the prices can be found in the following link. During 2017, eggplant prices showed a decreasing trend that could be interpreted as the normalization of the prices. Since there is no further data for cucumbers, we were not able to analyse it after 2017.

refined_data %>% 
  filter(market=="National Average")%>%
  group_by(name, year) %>%
  summarise(yearly_average_price=mean(value)) %>%
  mutate(YoY_growth = (yearly_average_price/lag(yearly_average_price))^(1/(year-lag(year))) - 1) %>%
  arrange(desc(YoY_growth)) %>%
  filter(name=="Eggplants - Retail" | name=="Onions - Retail" | name=="Cucumbers (greenhouse) - Retail") %>% 
  ggplot(aes(x = year, y = yearly_average_price, colour=name)) + 
  geom_line() + 
  geom_point()+
  labs( x="" , y = "Yearly Average Price")+ 
  theme(legend.position = "bottom", legend.title = element_blank(), axis.text.x = element_text(size = 10)) 

C. Category based time series with Shiny Plot

data1 <- refined_data %>%
          group_by(type, year) %>%
          summarise(yearly_average_price=mean(value))
          
food_types <- refined_data %>%
             distinct(type) %>%
             unlist(.)
names(food_types) <- NULL
ui <- fluidPage(
   
   titlePanel("Food Prices in Turkey per Category"),
   
   sidebarLayout(
      sidebarPanel(
      selectInput(inputId = "food_type", label = "Categories", choices = food_types)
      ),
      
      mainPanel(
         plotOutput("foodPlot")
      )
   )
)
server <- function(input, output) {
  
   output$foodPlot <- renderPlot({
       food_type_data_set <- data1 %>% filter(type == input$food_type)
     
      ggplot(food_type_data_set, aes(x = year, y = yearly_average_price)) +
          geom_line(stat = "identity") + aes(x = year, y = yearly_average_price) +
        geom_point()
          
   })
}
shinyApp(ui = ui, server = server)
Shiny applications not supported in static R Markdown documents

D.CONCLUSION

Most of the food prices seem to have increasing price trends majorly due to: