This document is based on price that in this link which shows fish price in Izmir Fish Market.
glimpse(FishPrice)
## Rows: 18,596
## Columns: 6
## $ TARIH <dttm> 2021-01-02, 2021-01-02, 2021-01-02, 2021-01-02, 2021-01-…
## $ MAL_TURU <chr> "BALIK", "BALIK", "BALIK", "BALIK", "BALIK", "BALIK", "BA…
## $ MAL_ADI <chr> "TIRSI (DENİZ)", "KIRLANGIÇ (DENİZ)", "ÇİMÇİM (DENİZ)", "…
## $ BIRIM <chr> "KG", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "KG", "KG…
## $ ASGARI_UCRET <dbl> 5.83, 3.00, 3.50, 2.50, 45.00, 130.00, 38.00, 25.00, 10.0…
## $ AZAMI_UCRET <dbl> 12.50, 80.00, 8.00, 5.00, 45.00, 130.00, 38.00, 55.00, 10…
As can be seen in below there are two prices that show the min and max value of products. Therefore I have added one more column that shows average.
FishPrice$Average_Price <- (FishPrice$ASGARI_UCRET + FishPrice$AZAMI_UCRET)/2
Thus, we basically have below values.
summary(FishPrice)
## TARIH MAL_TURU MAL_ADI
## Min. :2021-01-02 00:00:00 Length:18596 Length:18596
## 1st Qu.:2021-03-09 00:00:00 Class :character Class :character
## Median :2021-05-27 00:00:00 Mode :character Mode :character
## Mean :2021-05-27 15:32:05
## 3rd Qu.:2021-08-17 00:00:00
## Max. :2021-10-21 00:00:00
## BIRIM ASGARI_UCRET AZAMI_UCRET Average_Price
## Length:18596 Min. : 0.00 Min. : 0.42 Min. : 0.42
## Class :character 1st Qu.: 5.00 1st Qu.: 15.00 1st Qu.: 11.00
## Mode :character Median : 10.00 Median : 35.00 Median : 25.00
## Mean : 30.41 Mean : 65.53 Mean : 47.97
## 3rd Qu.: 34.00 3rd Qu.: 90.00 3rd Qu.: 63.00
## Max. :650.00 Max. :3500.00 Max. :1755.00
Basically the max value of price is 3500 min value of price is 0 while our average values have more meaning.
sum(is.null(FishPrice))
## [1] 0
There is not any NA values thus our data table is quite clear.
library(dplyr)
library(openxlsx)
Below tables show that fish prices have peak in the summer term. In Autumn, prices starts to drop.
fishplotsmoothgeneral= ggplot(data=FishPrice, aes(x = TARIH))+
geom_smooth(aes(y = Average_Price))
fishplotsmoothgeneral
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Most change has been observed in ITHAL(IMPORT)fish prices.
library(ggplot2)
fishplotsmooth = ggplot(data=FishPrice, aes(x = TARIH))+
geom_smooth(aes(y = Average_Price, color=as.character(MAL_TURU)))
fishplotsmooth
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
When we compare the first month and the last month by average prices. Average prices has been increased approximately %21. But in this perspective we ignore the volume of products.
library(ggplot2)
library(dplyr)
January<-FishPrice %>%
filter(TARIH >= ymd_hms("2021-01-01 00:00:00") & TARIH < ymd_hms("2021-01-31 24:00:00"))
January_Mean<-group_by(January, MAL_ADI)
January_Means<-summarize(January_Mean,mean(Average_Price))
October <- FishPrice %>%
filter(TARIH >= ymd_hms("2021-10-01 00:00:00") & TARIH < ymd_hms("2021-10-31 23:00:00"))
October_Mean<-group_by(October, MAL_ADI)
October_Means<-summarize(October_Mean,mean(Average_Price))
compare<-merge(x = January_Means, y = October_Means, by = "MAL_ADI", all.x = TRUE)
compare$comparetwo<-(compare$`mean(Average_Price).y`/compare$`mean(Average_Price).x`)-1
summary(compare)
## MAL_ADI mean(Average_Price).x mean(Average_Price).y
## Length:102 Min. : 2.00 Min. : 3.245
## Class :character 1st Qu.: 11.85 1st Qu.: 12.559
## Mode :character Median : 21.54 Median : 25.234
## Mean : 38.10 Mean : 50.431
## 3rd Qu.: 43.72 3rd Qu.: 62.524
## Max. :217.08 Max. :407.500
## NA's :10
## comparetwo
## Min. :-0.67597
## 1st Qu.:-0.08808
## Median : 0.17884
## Mean : 0.21297
## 3rd Qu.: 0.45072
## Max. : 1.48108
## NA's :10
While in January prices were increasing, in October prices are decreasing. In below graphs it can be observed easily.
library(ggplot2)
fishplotsmooth2 = ggplot(data=January, aes(x = TARIH))+
geom_smooth(aes(y = Average_Price,))
fishplotsmooth2
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
fishplotsmooth3 = ggplot(data=October, aes(x = TARIH))+
geom_smooth(aes(y = Average_Price,))
fishplotsmooth3
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Lastly, it is important to observe that the ratios between fisrt and last months.
library(dplyr)
library(tidyverse)
compareplot = ggplot(data=compare, aes(x = MAL_ADI))+
geom_point(aes(y = comparetwo,))
compareplot
## Warning: Removed 10 rows containing missing values (geom_point).