library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.5     v stringr 1.4.0
## v tidyr   1.1.4     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(tidyr)
library(readr)
balik_hal_fiyatlari <- read.csv(file = "C:/Users/kbkerimoglu/balik_hal_fiyatlari.csv", 
                                stringsAsFactors = FALSE, header = TRUE,sep = ";", encoding="UTF-8")

Basic Exploration

Although average percentage change prices are close to each other, fish prices are most volatile for MERCAN(BÜYÜKBOY) and BARBUN(TEKİR). Moreover, when we examine according to seasons price, “SONBAHAR” price is almost 50% higher than the “KIS” price.

  balik_hal_fiyatlari %>% filter(MAL_TURU == 'BALIK') %>%
  mutate(DAILY_DF = AZAMI_UCRET - ASGARI_UCRET) %>% group_by(MAL_ADI) %>%
  summarise(DAILY_DF_AVG = mean(DAILY_DF)) %>% 
  arrange(desc(DAILY_DF_AVG)) %>% head(5)
## # A tibble: 5 x 2
##   MAL_ADI           DAILY_DF_AVG
##   <chr>                    <dbl>
## 1 MERCAN (BÜYÜKBOY)         193.
## 2 İSTAKOZ (DENİZ)           175.
## 3 KARİDES (DENİZ)           170.
## 4 DIL                       146.
## 5 BARBUN (TEKİR)            143.
  plot_vis <- balik_hal_fiyatlari %>% filter(MAL_TURU == 'BALIK') %>%
  mutate(DAILY_DF = AZAMI_UCRET - ASGARI_UCRET) %>% group_by(MAL_ADI) %>%
  summarise(DAILY_DF_AVG = mean(DAILY_DF)) %>% 
  arrange(desc(DAILY_DF_AVG)) %>% head(5)
  ggplot(plot_vis, aes(x = MAL_ADI, y = DAILY_DF_AVG, fill=MAL_ADI)) +
    geom_bar(stat = "identity")

balik_hal_fiyatlari %>% filter(MAL_TURU == 'BALIK') %>% 
  mutate(DAILY_DF = AZAMI_UCRET - ASGARI_UCRET, DAILY_AVG = (AZAMI_UCRET + ASGARI_UCRET) / 2)%>%
  mutate(DAILY_AVG_PERCENTAGE = (DAILY_DF /2) / DAILY_AVG*100) %>% group_by(MAL_ADI) %>%
  summarise(MEAN_AVG_PERCENTAGE = mean(DAILY_AVG_PERCENTAGE), MEAN_DAILY_DF = mean(DAILY_DF)) %>%
  arrange(desc(MEAN_AVG_PERCENTAGE)) %>% head(5)
## # A tibble: 5 x 3
##   MAL_ADI           MEAN_AVG_PERCENTAGE MEAN_DAILY_DF
##   <chr>                           <dbl>         <dbl>
## 1 MERCAN (BÜYÜKBOY)                86.8         193. 
## 2 KUPEZ (DENİZ)                    84.9          19.4
## 3 LİDAKİ (DENİZ)                   79.5          57.6
## 4 KIRLANGIÇ (DENİZ)                78.8          90.2
## 5 BARBUN (TEKİR)                   78.3         143.
plot_perc <- balik_hal_fiyatlari %>% filter(MAL_TURU == 'BALIK') %>% 
  mutate(DAILY_DF = AZAMI_UCRET - ASGARI_UCRET, DAILY_AVG = (AZAMI_UCRET + ASGARI_UCRET) / 2)%>%
  mutate(DAILY_AVG_PERCENTAGE = (DAILY_DF /2) / DAILY_AVG*100) %>% group_by(MAL_ADI) %>%
  summarise(MEAN_AVG_PERCENTAGE = mean(DAILY_AVG_PERCENTAGE), MEAN_DAILY_DF = mean(DAILY_DF)) %>%
  arrange(desc(MEAN_AVG_PERCENTAGE)) %>% head(5)
ggplot(plot_perc, aes(x = MEAN_AVG_PERCENTAGE, y = MEAN_DAILY_DF, fill = MAL_ADI)) + geom_bar(stat = 'identity', alpha = 0.5, size = 5)

plot_seasons <- balik_hal_fiyatlari %>% mutate(AY=lubridate::month(TARIH)) %>%
  mutate(TARIH_MEVSIM=case_when(AY<=12 & AY>=9 ~"SONBAHAR",  AY <=9 & AY >=6 ~ "YAZ",  AY<=6 & AY>=3 ~"ILKBAHAR", AY<3 ~ "KIS"), DAILY_DF = AZAMI_UCRET- ASGARI_UCRET)%>%
  group_by(TARIH_MEVSIM)%>% summarise(MEAN_DAILY_DF=mean(DAILY_DF))
plot_seasons
## # A tibble: 4 x 2
##   TARIH_MEVSIM MEAN_DAILY_DF
##   <chr>                <dbl>
## 1 ILKBAHAR              30.6
## 2 KIS                   27.9
## 3 SONBAHAR              42.9
## 4 YAZ                   38.9
ggplot(plot_seasons, aes(x = reorder(TARIH_MEVSIM,MEAN_DAILY_DF), y = MEAN_DAILY_DF, fill = TARIH_MEVSIM)) +
  geom_bar(stat = 'identity')