library(tidyverse)
library(lubridate)
library(rvest)
library(ggplot2)
library(scales)
library(dplyr)
library(plyr)
library(data.table)

Acquisition and Introduction of the Data

# Temporary file for "Planning"
planning_temp=tempfile(fileext=".xlsx")
# Temporary file for "Production"
production_temp=tempfile(fileext=".xlsx")
# Temporary file for "Consumption"
consumption_temp=tempfile(fileext=".xlsx")
# Downloading file from repository to the "Planning" temp
download.file("https://raw.githubusercontent.com/pjournal/mef03g-Kar-R-sizlar/master/4-year-planning.csv?raw=true",destfile=planning_temp,mode='wb')
# Downloading file from repository to the "Production" temp
download.file("https://raw.githubusercontent.com/pjournal/mef03g-Kar-R-sizlar/master/4-year-production.csv?raw=true",destfile=production_temp,mode='wb')
# Downloading file from repository to the "Consumption" temp
download.file("https://raw.githubusercontent.com/pjournal/mef03g-Kar-R-sizlar/master/4-year-consumption.csv?raw=true",destfile=consumption_temp,mode='wb')
# Reading the csv files.
planning_raw_data=read.csv(planning_temp,skip=1)
production_raw_data=read.csv(production_temp,skip=1)
consumption_raw_data=read.csv(consumption_temp,skip=1)
# Removing the temp files
file.remove(planning_temp)
## [1] TRUE
file.remove(production_temp)
## [1] TRUE
file.remove(consumption_temp)
## [1] TRUE

Preparation and Introduction of Planning Data

  • 4 Year Planning Data: This data includes 33599 rows and 15 variables for the planned pruduction between January 1st, 2016 and October 31st, 2019
# Proper Column Names
colnames(planning_raw_data) <-  c('tarih', 'saat', 'toplam_mwh', 'dogal_gaz', 'ruzgar', 'linyit', 'tas_komur', 'ithal_komur', 'fuel_oil', 'jeotermal', 'barajli', 'nafta', 'biyokutle', 'akarsu', 'diger')
# Proper Data Format
planning_raw_data[,3:15]  <- as.data.frame(lapply(planning_raw_data[,3:15], function(x) as.numeric(gsub(",", ".", gsub("\\.", "", x)))))
planning_raw_data$tarih <-as.character(planning_raw_data$tarih)
planning_raw_data$saat <-as.character(planning_raw_data$saat)
head(planning_raw_data, 5)
##        tarih  saat toplam_mwh dogal_gaz ruzgar  linyit tas_komur
## 1 01.01.2016 01:00   18735.09   5471.14 168.48 4139.53       736
## 2 01.01.2016 02:00   17662.05   5182.14 168.44 4139.53       736
## 3 01.01.2016 03:00   17059.91   5146.13 159.71 4139.53       736
## 4 01.01.2016 04:00   16903.33   4990.13 149.83 4139.53       736
## 5 01.01.2016 05:00   16845.48   4941.13 138.38 4139.53       736
##   ithal_komur fuel_oil jeotermal barajli nafta biyokutle akarsu diger
## 1        4587      115     104.1    3166     5         0 122.84   120
## 2        4470      115     104.1    2499     5         0 122.84   120
## 3        4470      115     104.1    1943     5         0 121.44   120
## 4        4470      115     104.1    1943     5         0 130.74   120
## 5        4470      115     104.1    1943     5         0 133.34   120

Preparation and Introduction of Production Data

  • 4 Year Production Data: This data includes 33597 rows and 18 variables for the actual pruduction between January 1st, 2016 and October 31st, 2019
# Defining Column Names
colnames(production_raw_data) <-  c('tarih', 'saat', 'toplam_mwh', 'dogal_gaz', 'barajli', 'linyit', 'akarsu', 'ithal_komur', 'ruzgar', 'gunes', 'fuel_oil', 'jeotermal', 'asfaltit_komur', 'tas_komur', 'biyokutle', 'nafta', 'lng', 'uluslararasi')
# Proper Data Format
production_raw_data[,3:18]  <- as.data.frame(lapply(production_raw_data[,3:18], function(x) as.numeric(gsub(",", ".", gsub("\\.", "", x)))))
production_raw_data$tarih <-as.character(production_raw_data$tarih)
production_raw_data$saat <-as.character(production_raw_data$saat)
head(production_raw_data, 5)
##        tarih  saat toplam_mwh dogal_gaz barajli  linyit akarsu ithal_komur
## 1 01.01.2016 01:00   24491.99   6430.37 3604.49 4997.36 546.70     5269.60
## 2 01.01.2016 02:00   23109.42   5814.91 2865.77 5018.45 559.95     5165.70
## 3 01.01.2016 03:00   22037.52   5668.09 2156.75 4984.45 551.79     5148.64
## 4 01.01.2016 04:00   21527.40   5811.11 1665.71 4942.55 521.65     5123.66
## 5 01.01.2016 05:00   21560.19   5899.45 1809.77 4949.23 591.53     4917.75
##    ruzgar gunes fuel_oil jeotermal asfaltit_komur tas_komur biyokutle
## 1 2277.69     0    174.3    485.05          92.73     451.5    162.20
## 2 2278.95     0    176.1    485.97         128.06     455.5    160.06
## 3 2123.17     0    175.1    479.14         134.68     455.5    160.21
## 4 2057.80     0    177.2    466.16         136.89     462.5    162.17
## 5 1987.09     0    178.0    478.42         134.68     451.5    162.77
##   nafta lng uluslararasi
## 1     0   0            0
## 2     0   0            0
## 3     0   0            0
## 4     0   0            0
## 5     0   0            0

Preparation and Introduction of Consumption Data

  • 4 Year Consumpiton Data: This data includes 33575 rows and 3 variables for actual consumption between January 1st, 2016 and October 31st, 2019
# Defining Column Names
colnames(consumption_raw_data) <-  c('tarih', 'saat', 'tuketim_miktari_mwh')
# Proper Data Format
consumption_raw_data <-  cbind(consumption_raw_data, consumption_raw_data)
consumption_raw_data[,3:6]  <- as.data.frame(lapply(consumption_raw_data[,3:6], function(x) as.numeric(gsub(",", ".", gsub("\\.", "", x)))))
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
consumption_raw_data <- consumption_raw_data[, 1:3]
consumption_raw_data$tarih <-as.character(consumption_raw_data$tarih)
consumption_raw_data$saat <-as.character(consumption_raw_data$saat)
head(consumption_raw_data, 5)
##        tarih  saat tuketim_miktari_mwh
## 1 01.01.2016 01:00            24991.82
## 2 01.01.2016 02:00            23532.61
## 3 01.01.2016 03:00            22464.78
## 4 01.01.2016 04:00            22002.91
## 5 01.01.2016 05:00            21957.08

4 Year Planning Analysis: January 2016 - October 2019

planning_source_distribution<-planning_raw_data%>%
  summarise(toplam_mwh=sum(toplam_mwh),dogal_gaz=sum(dogal_gaz),ruzgar=sum(ruzgar),linyit=sum(linyit),tas_komur=sum(tas_komur),ithal_komur=sum(ithal_komur),fuel_oil=sum(fuel_oil), jeotermal=sum(jeotermal), barajli=sum(barajli), nafta=sum(nafta), biyokutle=sum(biyokutle),akarsu=sum(akarsu),diger=sum(diger))%>%
  transmute(dogal_gaz_ratio=dogal_gaz/toplam_mwh*100, ruzgar_ratio=ruzgar/toplam_mwh*100, linyit_ratio=linyit/toplam_mwh*100, tas_komur_ratio=tas_komur/toplam_mwh*100, ithal_komur_ratio=ithal_komur/toplam_mwh*100, fuel_oil_ratio=fuel_oil/toplam_mwh*100, jeotermal_ratio=jeotermal/toplam_mwh*100, barajli_ratio=barajli/toplam_mwh*100, nafta_ratio=nafta/toplam_mwh*100, biyokutle_ratio=biyokutle/toplam_mwh*100, akarsu_ratio=akarsu/toplam_mwh*100,diger_ratio=diger/toplam_mwh*100)

planning_source_distribution
##   dogal_gaz_ratio ruzgar_ratio linyit_ratio tas_komur_ratio
## 1        30.57317     6.324945     13.76322        1.495145
##   ithal_komur_ratio fuel_oil_ratio jeotermal_ratio barajli_ratio
## 1           18.7245      0.3351872        1.980785      18.96739
##   nafta_ratio biyokutle_ratio akarsu_ratio diger_ratio
## 1 0.006768052       0.5881827     6.332958   0.8858297
Planning_Distribution<- t(planning_source_distribution)
colnames(Planning_Distribution)[1] <- "Oran"
Planning_Distribution<-as.data.frame(Planning_Distribution)
Planning_Distribution <- Planning_Distribution %>% 
  rownames_to_column(var = "Kaynaklar")
Planning_Distribution %>% 
  arrange(desc(Oran))
##            Kaynaklar         Oran
## 1    dogal_gaz_ratio 30.573171207
## 2      barajli_ratio 18.967390786
## 3  ithal_komur_ratio 18.724497742
## 4       linyit_ratio 13.763221919
## 5       akarsu_ratio  6.332957557
## 6       ruzgar_ratio  6.324944516
## 7    jeotermal_ratio  1.980785003
## 8    tas_komur_ratio  1.495144766
## 9        diger_ratio  0.885829680
## 10   biyokutle_ratio  0.588182655
## 11    fuel_oil_ratio  0.335187182
## 12       nafta_ratio  0.006768052
ggplot(Planning_Distribution, aes(x="", y=Oran, fill=factor(Kaynaklar))) + geom_bar(stat="identity", width=1) + coord_polar("y", start=0) +geom_text(aes(label = paste0(round(Oran),"%")), position = position_stack(vjust = 0.5)) + labs(x = NULL, y = NULL, fill = NULL, title = "Planning:General Graphics Distribution by Source") + theme_classic() + theme(axis.line = element_blank(),
          axis.text = element_blank(),
          axis.ticks = element_blank(),
          plot.title = element_text(hjust = 0.5, color = "#666666"))

Creating Monthly Sums for Planning

jan2016_planning_1 <- planning_raw_data %>% filter(grepl("01.2016", tarih))
jan_daily_2016_planning <- ddply(jan2016_planning_1,"tarih",numcolwise(sum))
January_2016_Planning <- colSums(Filter(is.numeric, jan2016_planning_1))
jan_monthly_2016_planning <- as.data.frame(January_2016_Planning)
feb2016_planning_1 <- planning_raw_data %>% filter(grepl("02.2016", tarih))
feb_daily_2016_planning <- ddply(feb2016_planning_1,"tarih",numcolwise(sum))
February_2016_Planning <- colSums(Filter(is.numeric, feb2016_planning_1))
feb_monthly_2016_planning <- as.data.frame(February_2016_Planning)
mar2016_planning_1 <- planning_raw_data %>% filter(grepl("03.2016", tarih))
mar_daily_2016_planning <- ddply(jan2016_planning_1,"tarih",numcolwise(sum))
March_2016_Planning <- colSums(Filter(is.numeric, mar2016_planning_1))
mar_monthly_2016_planning <- as.data.frame(March_2016_Planning)
apr2016_planning_1 <- planning_raw_data %>% filter(grepl("04.2016", tarih))
apr_daily_2016_planning <- ddply(apr2016_planning_1,"tarih",numcolwise(sum))
April_2016_Planning <- colSums(Filter(is.numeric, apr2016_planning_1))
apr_monthly_2016_planning <- as.data.frame(April_2016_Planning)
may2016_planning_1 <- planning_raw_data %>% filter(grepl("05.2016", tarih))
may_daily_2016_planning <- ddply(may2016_planning_1,"tarih",numcolwise(sum))
May_2016_Planning <- colSums(Filter(is.numeric, may2016_planning_1))
may_monthly_2016_planning <- as.data.frame(May_2016_Planning)
jun2016_planning_1 <- planning_raw_data %>% filter(grepl("06.2016", tarih))
jun_daily_2016_planning <- ddply(jun2016_planning_1,"tarih",numcolwise(sum))
June_2016_Planning <- colSums(Filter(is.numeric, jun2016_planning_1))
jun_monthly_2016_planning <- as.data.frame(June_2016_Planning)
jul2016_planning_1 <- planning_raw_data %>% filter(grepl("07.2016", tarih))
jul_daily_2016_planning <- ddply(jul2016_planning_1,"tarih",numcolwise(sum))
July_2016_Planning <- colSums(Filter(is.numeric, jul2016_planning_1))
jul_monthly_2016_planning <- as.data.frame(July_2016_Planning)
aug2016_planning_1 <- planning_raw_data %>% filter(grepl("08.2016", tarih))
aug_daily_2016_planning <- ddply(aug2016_planning_1,"tarih",numcolwise(sum))
August_2016_Planning <- colSums(Filter(is.numeric, aug2016_planning_1))
aug_monthly_2016_planning <- as.data.frame(August_2016_Planning)
sep2016_planning_1 <- planning_raw_data %>% filter(grepl("09.2016", tarih))
sep_daily_2016_planning <- ddply(sep2016_planning_1,"tarih",numcolwise(sum))
September_2016_Planning <- colSums(Filter(is.numeric, sep2016_planning_1))
sep_monthly_2016_planning <- as.data.frame(September_2016_Planning)
oct2016_planning_1 <- planning_raw_data %>% filter(grepl("10.2016", tarih))
oct_daily_2016_planning <- ddply(oct2016_planning_1,"tarih",numcolwise(sum))
October_2016_Planning <- colSums(Filter(is.numeric, oct2016_planning_1))
oct_monthly_2016_planning <- as.data.frame(October_2016_Planning)
nov2016_planning_1 <- planning_raw_data %>% filter(grepl("11.2016", tarih))
nov_daily_2016_planning <- ddply(nov2016_planning_1,"tarih",numcolwise(sum))
November_2016_Planning <- colSums(Filter(is.numeric, nov2016_planning_1))
nov_monthly_2016_planning <- as.data.frame(November_2016_Planning)
dec2016_planning_1 <- planning_raw_data %>% filter(grepl("12.2016", tarih))
dec_daily_2016_planning <- ddply(dec2016_planning_1,"tarih",numcolwise(sum))
December_2016_Planning <- colSums(Filter(is.numeric, dec2016_planning_1))
dec_monthly_2016_planning <- as.data.frame(December_2016_Planning)
Planning_2016_Monthly <- cbind(jan_monthly_2016_planning, feb_monthly_2016_planning, mar_monthly_2016_planning, apr_monthly_2016_planning, may_monthly_2016_planning, jun_monthly_2016_planning, jul_monthly_2016_planning, aug_monthly_2016_planning, sep_monthly_2016_planning, oct_monthly_2016_planning, nov_monthly_2016_planning, dec_monthly_2016_planning)
jan2017_planning_1 <- planning_raw_data %>% filter(grepl("01.2017", tarih))
jan_daily_2017_planning <- ddply(jan2017_planning_1,"tarih",numcolwise(sum))
January_2017_Planning <- colSums(Filter(is.numeric, jan2017_planning_1))
jan_monthly_2017_planning <- as.data.frame(January_2017_Planning)
feb2017_planning_1 <- planning_raw_data %>% filter(grepl("02.2017", tarih))
feb_daily_2017_planning <- ddply(feb2017_planning_1,"tarih",numcolwise(sum))
February_2017_Planning <- colSums(Filter(is.numeric, feb2017_planning_1))
feb_monthly_2017_planning <- as.data.frame(February_2017_Planning)
mar2017_planning_1 <- planning_raw_data %>% filter(grepl("03.2017", tarih))
mar_daily_2017_planning <- ddply(jan2017_planning_1,"tarih",numcolwise(sum))
March_2017_Planning <- colSums(Filter(is.numeric, mar2017_planning_1))
mar_monthly_2017_planning <- as.data.frame(March_2017_Planning)
apr2017_planning_1 <- planning_raw_data %>% filter(grepl("04.2017", tarih))
apr_daily_2017_planning <- ddply(apr2017_planning_1,"tarih",numcolwise(sum))
April_2017_Planning <- colSums(Filter(is.numeric, apr2017_planning_1))
apr_monthly_2017_planning <- as.data.frame(April_2017_Planning)
may2017_planning_1 <- planning_raw_data %>% filter(grepl("05.2017", tarih))
may_daily_2017_planning <- ddply(may2017_planning_1,"tarih",numcolwise(sum))
May_2017_Planning <- colSums(Filter(is.numeric, may2017_planning_1))
may_monthly_2017_planning <- as.data.frame(May_2017_Planning)
jun2017_planning_1 <- planning_raw_data %>% filter(grepl("06.2017", tarih))
jun_daily_2017_planning <- ddply(jun2017_planning_1,"tarih",numcolwise(sum))
June_2017_Planning <- colSums(Filter(is.numeric, jun2017_planning_1))
jun_monthly_2017_planning <- as.data.frame(June_2017_Planning)
jul2017_planning_1 <- planning_raw_data %>% filter(grepl("07.2017", tarih))
jul_daily_2017_planning <- ddply(jul2017_planning_1,"tarih",numcolwise(sum))
July_2017_Planning <- colSums(Filter(is.numeric, jul2017_planning_1))
jul_monthly_2017_planning <- as.data.frame(July_2017_Planning)
aug2017_planning_1 <- planning_raw_data %>% filter(grepl("08.2017", tarih))
aug_daily_2017_planning <- ddply(aug2017_planning_1,"tarih",numcolwise(sum))
August_2017_Planning <- colSums(Filter(is.numeric, aug2017_planning_1))
aug_monthly_2017_planning <- as.data.frame(August_2017_Planning)
sep2017_planning_1 <- planning_raw_data %>% filter(grepl("09.2017", tarih))
sep_daily_2017_planning <- ddply(sep2017_planning_1,"tarih",numcolwise(sum))
September_2017_Planning <- colSums(Filter(is.numeric, sep2017_planning_1))
sep_monthly_2017_planning <- as.data.frame(September_2017_Planning)
oct2017_planning_1 <- planning_raw_data %>% filter(grepl("10.2017", tarih))
oct_daily_2017_planning <- ddply(oct2017_planning_1,"tarih",numcolwise(sum))
October_2017_Planning <- colSums(Filter(is.numeric, oct2017_planning_1))
oct_monthly_2017_planning <- as.data.frame(October_2017_Planning)
nov2017_planning_1 <- planning_raw_data %>% filter(grepl("11.2017", tarih))
nov_daily_2017_planning <- ddply(nov2017_planning_1,"tarih",numcolwise(sum))
November_2017_Planning <- colSums(Filter(is.numeric, nov2017_planning_1))
nov_monthly_2017_planning <- as.data.frame(November_2017_Planning)
dec2017_planning_1 <- planning_raw_data %>% filter(grepl("12.2017", tarih))
dec_daily_2017_planning <- ddply(dec2017_planning_1,"tarih",numcolwise(sum))
December_2017_Planning <- colSums(Filter(is.numeric, dec2017_planning_1))
dec_monthly_2017_planning <- as.data.frame(December_2017_Planning)
Planning_2017_Monthly <- cbind(jan_monthly_2017_planning, feb_monthly_2017_planning, mar_monthly_2017_planning, apr_monthly_2017_planning, may_monthly_2017_planning, jun_monthly_2017_planning, jul_monthly_2017_planning, aug_monthly_2017_planning, sep_monthly_2017_planning, oct_monthly_2017_planning, nov_monthly_2017_planning, dec_monthly_2017_planning)
jan2018_planning_1 <- planning_raw_data %>% filter(grepl("01.2018", tarih))
jan_daily_2018_planning <- ddply(jan2018_planning_1,"tarih",numcolwise(sum))
January_2018_Planning <- colSums(Filter(is.numeric, jan2018_planning_1))
jan_monthly_2018_planning <- as.data.frame(January_2018_Planning)
feb2018_planning_1 <- planning_raw_data %>% filter(grepl("02.2018", tarih))
feb_daily_2018_planning <- ddply(feb2018_planning_1,"tarih",numcolwise(sum))
February_2018_Planning <- colSums(Filter(is.numeric, feb2018_planning_1))
feb_monthly_2018_planning <- as.data.frame(February_2018_Planning)
mar2018_planning_1 <- planning_raw_data %>% filter(grepl("03.2018", tarih))
mar_daily_2018_planning <- ddply(jan2018_planning_1,"tarih",numcolwise(sum))
March_2018_Planning <- colSums(Filter(is.numeric, mar2018_planning_1))
mar_monthly_2018_planning <- as.data.frame(March_2018_Planning)
apr2018_planning_1 <- planning_raw_data %>% filter(grepl("04.2018", tarih))
apr_daily_2018_planning <- ddply(apr2018_planning_1,"tarih",numcolwise(sum))
April_2018_Planning <- colSums(Filter(is.numeric, apr2018_planning_1))
apr_monthly_2018_planning <- as.data.frame(April_2018_Planning)
may2018_planning_1 <- planning_raw_data %>% filter(grepl("05.2018", tarih))
may_daily_2018_planning <- ddply(may2018_planning_1,"tarih",numcolwise(sum))
May_2018_Planning <- colSums(Filter(is.numeric, may2018_planning_1))
may_monthly_2018_planning <- as.data.frame(May_2018_Planning)
jun2018_planning_1 <- planning_raw_data %>% filter(grepl("06.2018", tarih))
jun_daily_2018_planning <- ddply(jun2018_planning_1,"tarih",numcolwise(sum))
June_2018_Planning <- colSums(Filter(is.numeric, jun2018_planning_1))
jun_monthly_2018_planning <- as.data.frame(June_2018_Planning)
jul2018_planning_1 <- planning_raw_data %>% filter(grepl("07.2018", tarih))
jul_daily_2018_planning <- ddply(jul2018_planning_1,"tarih",numcolwise(sum))
July_2018_Planning <- colSums(Filter(is.numeric, jul2018_planning_1))
jul_monthly_2018_planning <- as.data.frame(July_2018_Planning)
aug2018_planning_1 <- planning_raw_data %>% filter(grepl("08.2018", tarih))
aug_daily_2018_planning <- ddply(aug2018_planning_1,"tarih",numcolwise(sum))
August_2018_Planning <- colSums(Filter(is.numeric, aug2018_planning_1))
aug_monthly_2018_planning <- as.data.frame(August_2018_Planning)
sep2018_planning_1 <- planning_raw_data %>% filter(grepl("09.2018", tarih))
sep_daily_2018_planning <- ddply(sep2018_planning_1,"tarih",numcolwise(sum))
September_2018_Planning <- colSums(Filter(is.numeric, sep2018_planning_1))
sep_monthly_2018_planning <- as.data.frame(September_2018_Planning)
oct2018_planning_1 <- planning_raw_data %>% filter(grepl("10.2018", tarih))
oct_daily_2018_planning <- ddply(oct2018_planning_1,"tarih",numcolwise(sum))
October_2018_Planning <- colSums(Filter(is.numeric, oct2018_planning_1))
oct_monthly_2018_planning <- as.data.frame(October_2018_Planning)
nov2018_planning_1 <- planning_raw_data %>% filter(grepl("11.2018", tarih))
nov_daily_2018_planning <- ddply(nov2018_planning_1,"tarih",numcolwise(sum))
November_2018_Planning <- colSums(Filter(is.numeric, nov2018_planning_1))
nov_monthly_2018_planning <- as.data.frame(November_2018_Planning)
dec2018_planning_1 <- planning_raw_data %>% filter(grepl("12.2018", tarih))
dec_daily_2018_planning <- ddply(dec2018_planning_1,"tarih",numcolwise(sum))
December_2018_Planning <- colSums(Filter(is.numeric, dec2018_planning_1))
dec_monthly_2018_planning <- as.data.frame(December_2018_Planning)
Planning_2018_Monthly <- cbind(jan_monthly_2018_planning, feb_monthly_2018_planning, mar_monthly_2018_planning, apr_monthly_2018_planning, may_monthly_2018_planning, jun_monthly_2018_planning, jul_monthly_2018_planning, aug_monthly_2018_planning, sep_monthly_2018_planning, oct_monthly_2018_planning, nov_monthly_2018_planning, dec_monthly_2018_planning)
jan2019_planning_1 <- planning_raw_data %>% filter(grepl("01.2019", tarih))
jan_daily_2019_planning <- ddply(jan2019_planning_1,"tarih",numcolwise(sum))
January_2019_Planning <- colSums(Filter(is.numeric, jan2019_planning_1))
jan_monthly_2019_planning <- as.data.frame(January_2019_Planning)
feb2019_planning_1 <- planning_raw_data %>% filter(grepl("02.2019", tarih))
feb_daily_2019_planning <- ddply(feb2019_planning_1,"tarih",numcolwise(sum))
February_2019_Planning <- colSums(Filter(is.numeric, feb2019_planning_1))
feb_monthly_2019_planning <- as.data.frame(February_2019_Planning)
mar2019_planning_1 <- planning_raw_data %>% filter(grepl("03.2019", tarih))
mar_daily_2019_planning <- ddply(jan2019_planning_1,"tarih",numcolwise(sum))
March_2019_Planning <- colSums(Filter(is.numeric, mar2019_planning_1))
mar_monthly_2019_planning <- as.data.frame(March_2019_Planning)
apr2019_planning_1 <- planning_raw_data %>% filter(grepl("04.2019", tarih))
apr_daily_2019_planning <- ddply(apr2019_planning_1,"tarih",numcolwise(sum))
April_2019_Planning <- colSums(Filter(is.numeric, apr2019_planning_1))
apr_monthly_2019_planning <- as.data.frame(April_2019_Planning)
may2019_planning_1 <- planning_raw_data %>% filter(grepl("05.2019", tarih))
may_daily_2019_planning <- ddply(may2019_planning_1,"tarih",numcolwise(sum))
May_2019_Planning <- colSums(Filter(is.numeric, may2019_planning_1))
may_monthly_2019_planning <- as.data.frame(May_2019_Planning)
jun2019_planning_1 <- planning_raw_data %>% filter(grepl("06.2019", tarih))
jun_daily_2019_planning <- ddply(jun2019_planning_1,"tarih",numcolwise(sum))
June_2019_Planning <- colSums(Filter(is.numeric, jun2019_planning_1))
jun_monthly_2019_planning <- as.data.frame(June_2019_Planning)
jul2019_planning_1 <- planning_raw_data %>% filter(grepl("07.2019", tarih))
jul_daily_2019_planning <- ddply(jul2019_planning_1,"tarih",numcolwise(sum))
July_2019_Planning <- colSums(Filter(is.numeric, jul2019_planning_1))
jul_monthly_2019_planning <- as.data.frame(July_2019_Planning)
aug2019_planning_1 <- planning_raw_data %>% filter(grepl("08.2019", tarih))
aug_daily_2019_planning <- ddply(aug2019_planning_1,"tarih",numcolwise(sum))
August_2019_Planning <- colSums(Filter(is.numeric, aug2019_planning_1))
aug_monthly_2019_planning <- as.data.frame(August_2019_Planning)
sep2019_planning_1 <- planning_raw_data %>% filter(grepl("09.2019", tarih))
sep_daily_2019_planning <- ddply(sep2019_planning_1,"tarih",numcolwise(sum))
September_2019_Planning <- colSums(Filter(is.numeric, sep2019_planning_1))
sep_monthly_2019_planning <- as.data.frame(September_2019_Planning)
oct2019_planning_1 <- planning_raw_data %>% filter(grepl("10.2019", tarih))
oct_daily_2019_planning <- ddply(oct2019_planning_1,"tarih",numcolwise(sum))
October_2019_Planning <- colSums(Filter(is.numeric, oct2019_planning_1))
oct_monthly_2019_planning <- as.data.frame(October_2019_Planning)
Planning_2019_Monthly <- cbind(jan_monthly_2019_planning, feb_monthly_2019_planning, mar_monthly_2019_planning, apr_monthly_2019_planning, may_monthly_2019_planning, jun_monthly_2019_planning, jul_monthly_2019_planning, aug_monthly_2019_planning, sep_monthly_2019_planning, oct_monthly_2019_planning)
Planning_Monthly <- cbind(Planning_2016_Monthly, Planning_2017_Monthly, Planning_2018_Monthly, Planning_2019_Monthly)
Planning_Monthly <- rownames_to_column(Planning_Monthly, var = "Sources")
head(Planning_Monthly, 5)
##      Sources January_2016_Planning February_2016_Planning
## 1 toplam_mwh           18385705.14             16370337.6
## 2  dogal_gaz            6956584.34              5751946.6
## 3     ruzgar              97156.52               125460.9
## 4     linyit            2785761.43              2562704.7
## 5  tas_komur             553672.00               530251.0
##   March_2016_Planning April_2016_Planning May_2016_Planning
## 1          18588230.5          18356082.7        19877152.8
## 2           5427182.0           6086039.2         5080386.8
## 3            618063.5            487208.6          705477.8
## 4           2419856.9           1794657.9         2189355.6
## 5            630380.0            554156.0          575697.0
##   June_2016_Planning July_2016_Planning August_2016_Planning
## 1         20746099.8           21956748           23643419.4
## 2          6095654.4            7078596            8823670.8
## 3           949855.3            1543691            1486075.8
## 4          2393558.4            2352105            2787876.3
## 5           581260.0             526286             562867.7
##   September_2016_Planning October_2016_Planning November_2016_Planning
## 1                19316867            19853251.2               20416596
## 2                 6239807             7198373.4                7963266
## 3                 1113072              936597.2                1075415
## 4                 2605904             2786209.9                2944602
## 5                  486432              559910.0                 600124
##   December_2016_Planning January_2017_Planning February_2017_Planning
## 1               22035101              22896558               20395074
## 2                6404150               7150544                8071274
## 3                1293260               1355388                1264481
## 4                3453476               3091752                2550816
## 5                 468259                592147                 541018
##   March_2017_Planning April_2017_Planning May_2017_Planning
## 1            21348230          19887163.2          20584699
## 2             7900885           7002375.4           7195991
## 3             1119777            851122.8           1118693
## 4             2519660           2368677.4           2226712
## 5              505246            445155.0            379878
##   June_2017_Planning July_2017_Planning August_2017_Planning
## 1         19991227.5           25123552             25252276
## 2          7495669.3           10800321             10429291
## 3           868201.3            1710937              1924167
## 4          2703464.9            3150178              2897620
## 5           381940.0             336994               358882
##   September_2017_Planning October_2017_Planning November_2017_Planning
## 1                21908345              21326374             21463008.0
## 2                 9562382               9976147             10598539.9
## 3                  950810               1131337               901615.4
## 4                 2818234               2818423              2792746.3
## 5                  350164                398836               362860.0
##   December_2017_Planning January_2018_Planning February_2018_Planning
## 1               23167497              23437853               20874237
## 2                8535583               8754923                7060268
## 3                1767750               1585354                1586399
## 4                2886354               2960360                3173565
## 5                 407124                323369                  60690
##   March_2018_Planning April_2018_Planning May_2018_Planning
## 1            22269120            20986523          21234273
## 2             5849357             5950954           5176295
## 3             2068717             1184040           1219668
## 4             3398514             3257538           3425836
## 5               46464               56400             67757
##   June_2018_Planning July_2018_Planning August_2018_Planning
## 1           21044604           26014706             24621906
## 2            5612888            9815131              7266234
## 3            1227075            1445300              2347874
## 4            3364555            3480049              3435488
## 5              65191              71089                71124
##   September_2018_Planning October_2018_Planning November_2018_Planning
## 1                22433107              20928922               20998067
## 2                 8319682               7432901                6104561
## 3                 1697927               1450966                1943503
## 4                 3256088               3548988                3298925
## 5                   67285                 48226                  61687
##   December_2018_Planning January_2019_Planning February_2019_Planning
## 1               22817734            23835183.3             20747893.2
## 2                6138570             5013137.7              3029595.2
## 3                1594620             2193021.3              1848907.6
## 4                3368290             3167313.8              2951192.9
## 5                  90547               83890.6               146868.7
##   March_2019_Planning April_2019_Planning May_2019_Planning
## 1          21886745.2            20997373          21912778
## 2           3785709.1             2298879           1526804
## 3           2031214.9             1465802           1109466
## 4           3242018.5             3002714           3021061
## 5            197587.3              216933            209230
##   June_2019_Planning July_2019_Planning August_2019_Planning
## 1         21333372.4         25309947.4             24320486
## 2          2293347.6          5394795.1              4688801
## 3          1664576.9          1957964.5              2638033
## 4          3020739.0          3687543.9              3580506
## 5           214822.6           466350.3               364447
##   September_2019_Planning October_2019_Planning
## 1                22181033            20909598.5
## 2                 4388389             4166874.4
## 3                 1958124             1254835.6
## 4                 3536561             3725816.5
## 5                  148682               93336.4

Creating Monthly Sums for Production

jan2016_production_1 <- production_raw_data %>% filter(grepl("01.2016", tarih))
jan_daily_2016_production <- ddply(jan2016_production_1,"tarih",numcolwise(sum))
January_2016_Production <- colSums(Filter(is.numeric, jan2016_production_1))
jan_monthly_2016_production <- as.data.frame(January_2016_Production)
feb2016_production_1 <- production_raw_data %>% filter(grepl("02.2016", tarih))
feb_daily_2016_production <- ddply(feb2016_production_1,"tarih",numcolwise(sum))
February_2016_Production <- colSums(Filter(is.numeric, feb2016_production_1))
feb_monthly_2016_production <- as.data.frame(February_2016_Production)
mar2016_production_1 <- production_raw_data %>% filter(grepl("03.2016", tarih))
mar_daily_2016_production <- ddply(jan2016_production_1,"tarih",numcolwise(sum))
March_2016_Production <- colSums(Filter(is.numeric, mar2016_production_1))
mar_monthly_2016_production <- as.data.frame(March_2016_Production)
apr2016_production_1 <- production_raw_data %>% filter(grepl("04.2016", tarih))
apr_daily_2016_production <- ddply(apr2016_production_1,"tarih",numcolwise(sum))
April_2016_Production <- colSums(Filter(is.numeric, apr2016_production_1))
apr_monthly_2016_production <- as.data.frame(April_2016_Production)
may2016_production_1 <- production_raw_data %>% filter(grepl("05.2016", tarih))
may_daily_2016_production <- ddply(may2016_production_1,"tarih",numcolwise(sum))
May_2016_Production <- colSums(Filter(is.numeric, may2016_production_1))
may_monthly_2016_production <- as.data.frame(May_2016_Production)
jun2016_production_1 <- production_raw_data %>% filter(grepl("06.2016", tarih))
jun_daily_2016_production <- ddply(jun2016_production_1,"tarih",numcolwise(sum))
June_2016_Production <- colSums(Filter(is.numeric, jun2016_production_1))
jun_monthly_2016_production <- as.data.frame(June_2016_Production)
jul2016_production_1 <- production_raw_data %>% filter(grepl("07.2016", tarih))
jul_daily_2016_production <- ddply(jul2016_production_1,"tarih",numcolwise(sum))
July_2016_Production <- colSums(Filter(is.numeric, jul2016_production_1))
jul_monthly_2016_production <- as.data.frame(July_2016_Production)
aug2016_production_1 <- production_raw_data %>% filter(grepl("08.2016", tarih))
aug_daily_2016_production <- ddply(aug2016_production_1,"tarih",numcolwise(sum))
August_2016_Production <- colSums(Filter(is.numeric, aug2016_production_1))
aug_monthly_2016_production <- as.data.frame(August_2016_Production)
sep2016_production_1 <- production_raw_data %>% filter(grepl("09.2016", tarih))
sep_daily_2016_production <- ddply(sep2016_production_1,"tarih",numcolwise(sum))
September_2016_Production <- colSums(Filter(is.numeric, sep2016_production_1))
sep_monthly_2016_production <- as.data.frame(September_2016_Production)
oct2016_production_1 <- production_raw_data %>% filter(grepl("10.2016", tarih))
oct_daily_2016_production <- ddply(oct2016_production_1,"tarih",numcolwise(sum))
October_2016_Production <- colSums(Filter(is.numeric, oct2016_production_1))
oct_monthly_2016_production <- as.data.frame(October_2016_Production)
nov2016_production_1 <- production_raw_data %>% filter(grepl("11.2016", tarih))
nov_daily_2016_production <- ddply(nov2016_production_1,"tarih",numcolwise(sum))
November_2016_Production <- colSums(Filter(is.numeric, nov2016_production_1))
nov_monthly_2016_production <- as.data.frame(November_2016_Production)
dec2016_production_1 <- production_raw_data %>% filter(grepl("12.2016", tarih))
dec_daily_2016_production <- ddply(dec2016_production_1,"tarih",numcolwise(sum))
December_2016_Production <- colSums(Filter(is.numeric, dec2016_production_1))
dec_monthly_2016_production <- as.data.frame(December_2016_Production)
Production_2016_Monthly <- cbind(jan_monthly_2016_production, feb_monthly_2016_production, mar_monthly_2016_production, apr_monthly_2016_production, may_monthly_2016_production, jun_monthly_2016_production, jul_monthly_2016_production, aug_monthly_2016_production, sep_monthly_2016_production, oct_monthly_2016_production, nov_monthly_2016_production, dec_monthly_2016_production)
jan2017_production_1 <- production_raw_data %>% filter(grepl("01.2017", tarih))
jan_daily_2017_production <- ddply(jan2017_production_1,"tarih",numcolwise(sum))
January_2017_Production <- colSums(Filter(is.numeric, jan2017_production_1))
jan_monthly_2017_production <- as.data.frame(January_2017_Production)
feb2017_production_1 <- production_raw_data %>% filter(grepl("02.2017", tarih))
feb_daily_2017_production <- ddply(feb2017_production_1,"tarih",numcolwise(sum))
February_2017_Production <- colSums(Filter(is.numeric, feb2017_production_1))
feb_monthly_2017_production <- as.data.frame(February_2017_Production)
mar2017_production_1 <- production_raw_data %>% filter(grepl("03.2017", tarih))
mar_daily_2017_production <- ddply(jan2017_production_1,"tarih",numcolwise(sum))
March_2017_Production <- colSums(Filter(is.numeric, mar2017_production_1))
mar_monthly_2017_production <- as.data.frame(March_2017_Production)
apr2017_production_1 <- production_raw_data %>% filter(grepl("04.2017", tarih))
apr_daily_2017_production <- ddply(apr2017_production_1,"tarih",numcolwise(sum))
April_2017_Production <- colSums(Filter(is.numeric, apr2017_production_1))
apr_monthly_2017_production <- as.data.frame(April_2017_Production)
may2017_production_1 <- production_raw_data %>% filter(grepl("05.2017", tarih))
may_daily_2017_production <- ddply(may2017_production_1,"tarih",numcolwise(sum))
May_2017_Production <- colSums(Filter(is.numeric, may2017_production_1))
may_monthly_2017_production <- as.data.frame(May_2017_Production)
jun2017_production_1 <- production_raw_data %>% filter(grepl("06.2017", tarih))
jun_daily_2017_production <- ddply(jun2017_production_1,"tarih",numcolwise(sum))
June_2017_Production <- colSums(Filter(is.numeric, jun2017_production_1))
jun_monthly_2017_production <- as.data.frame(June_2017_Production)
jul2017_production_1 <- production_raw_data %>% filter(grepl("07.2017", tarih))
jul_daily_2017_production <- ddply(jul2017_production_1,"tarih",numcolwise(sum))
July_2017_Production <- colSums(Filter(is.numeric, jul2017_production_1))
jul_monthly_2017_production <- as.data.frame(July_2017_Production)
aug2017_production_1 <- production_raw_data %>% filter(grepl("08.2017", tarih))
aug_daily_2017_production <- ddply(aug2017_production_1,"tarih",numcolwise(sum))
August_2017_Production <- colSums(Filter(is.numeric, aug2017_production_1))
aug_monthly_2017_production <- as.data.frame(August_2017_Production)
sep2017_production_1 <- production_raw_data %>% filter(grepl("09.2017", tarih))
sep_daily_2017_production <- ddply(sep2017_production_1,"tarih",numcolwise(sum))
September_2017_Production <- colSums(Filter(is.numeric, sep2017_production_1))
sep_monthly_2017_production <- as.data.frame(September_2017_Production)
oct2017_production_1 <- production_raw_data %>% filter(grepl("10.2017", tarih))
oct_daily_2017_production <- ddply(oct2017_production_1,"tarih",numcolwise(sum))
October_2017_Production <- colSums(Filter(is.numeric, oct2017_production_1))
oct_monthly_2017_production <- as.data.frame(October_2017_Production)
nov2017_production_1 <- production_raw_data %>% filter(grepl("11.2017", tarih))
nov_daily_2017_production <- ddply(nov2017_production_1,"tarih",numcolwise(sum))
November_2017_Production <- colSums(Filter(is.numeric, nov2017_production_1))
nov_monthly_2017_production <- as.data.frame(November_2017_Production)
dec2017_production_1 <- production_raw_data %>% filter(grepl("12.2017", tarih))
dec_daily_2017_production <- ddply(dec2017_production_1,"tarih",numcolwise(sum))
December_2017_Production <- colSums(Filter(is.numeric, dec2017_production_1))
dec_monthly_2017_production <- as.data.frame(December_2017_Production)
Production_2017_Monthly <- cbind(jan_monthly_2017_production, feb_monthly_2017_production, mar_monthly_2017_production, apr_monthly_2017_production, may_monthly_2017_production, jun_monthly_2017_production, jul_monthly_2017_production, aug_monthly_2017_production, sep_monthly_2017_production, oct_monthly_2017_production, nov_monthly_2017_production, dec_monthly_2017_production)
jan2018_production_1 <- production_raw_data %>% filter(grepl("01.2018", tarih))
jan_daily_2018_production <- ddply(jan2018_production_1,"tarih",numcolwise(sum))
January_2018_Production <- colSums(Filter(is.numeric, jan2018_production_1))
jan_monthly_2018_production <- as.data.frame(January_2018_Production)
feb2018_production_1 <- production_raw_data %>% filter(grepl("02.2018", tarih))
feb_daily_2018_production <- ddply(feb2018_production_1,"tarih",numcolwise(sum))
February_2018_Production <- colSums(Filter(is.numeric, feb2018_production_1))
feb_monthly_2018_production <- as.data.frame(February_2018_Production)
mar2018_production_1 <- production_raw_data %>% filter(grepl("03.2018", tarih))
mar_daily_2018_production <- ddply(jan2018_production_1,"tarih",numcolwise(sum))
March_2018_Production <- colSums(Filter(is.numeric, mar2018_production_1))
mar_monthly_2018_production <- as.data.frame(March_2018_Production)
apr2018_production_1 <- production_raw_data %>% filter(grepl("04.2018", tarih))
apr_daily_2018_production <- ddply(apr2018_production_1,"tarih",numcolwise(sum))
April_2018_Production <- colSums(Filter(is.numeric, apr2018_production_1))
apr_monthly_2018_production <- as.data.frame(April_2018_Production)
may2018_production_1 <- production_raw_data %>% filter(grepl("05.2018", tarih))
may_daily_2018_production <- ddply(may2018_production_1,"tarih",numcolwise(sum))
May_2018_Production <- colSums(Filter(is.numeric, may2018_production_1))
may_monthly_2018_production <- as.data.frame(May_2018_Production)
jun2018_production_1 <- production_raw_data %>% filter(grepl("06.2018", tarih))
jun_daily_2018_production <- ddply(jun2018_production_1,"tarih",numcolwise(sum))
June_2018_Production <- colSums(Filter(is.numeric, jun2018_production_1))
jun_monthly_2018_production <- as.data.frame(June_2018_Production)
jul2018_production_1 <- production_raw_data %>% filter(grepl("07.2018", tarih))
jul_daily_2018_production <- ddply(jul2018_production_1,"tarih",numcolwise(sum))
July_2018_Production <- colSums(Filter(is.numeric, jul2018_production_1))
jul_monthly_2018_production <- as.data.frame(July_2018_Production)
aug2018_production_1 <- production_raw_data %>% filter(grepl("08.2018", tarih))
aug_daily_2018_production <- ddply(aug2018_production_1,"tarih",numcolwise(sum))
August_2018_Production <- colSums(Filter(is.numeric, aug2018_production_1))
aug_monthly_2018_production <- as.data.frame(August_2018_Production)
sep2018_production_1 <- production_raw_data %>% filter(grepl("09.2018", tarih))
sep_daily_2018_production <- ddply(sep2018_production_1,"tarih",numcolwise(sum))
September_2018_Production <- colSums(Filter(is.numeric, sep2018_production_1))
sep_monthly_2018_production <- as.data.frame(September_2018_Production)
oct2018_production_1 <- production_raw_data %>% filter(grepl("10.2018", tarih))
oct_daily_2018_production <- ddply(oct2018_production_1,"tarih",numcolwise(sum))
October_2018_Production <- colSums(Filter(is.numeric, oct2018_production_1))
oct_monthly_2018_production <- as.data.frame(October_2018_Production)
nov2018_production_1 <- production_raw_data %>% filter(grepl("11.2018", tarih))
nov_daily_2018_production <- ddply(nov2018_production_1,"tarih",numcolwise(sum))
November_2018_Production <- colSums(Filter(is.numeric, nov2018_production_1))
nov_monthly_2018_production <- as.data.frame(November_2018_Production)
dec2018_production_1 <- production_raw_data %>% filter(grepl("12.2018", tarih))
dec_daily_2018_production <- ddply(dec2018_production_1,"tarih",numcolwise(sum))
December_2018_Production <- colSums(Filter(is.numeric, dec2018_production_1))
dec_monthly_2018_production <- as.data.frame(December_2018_Production)
Production_2018_Monthly <- cbind(jan_monthly_2018_production, feb_monthly_2018_production, mar_monthly_2018_production, apr_monthly_2018_production, may_monthly_2018_production, jun_monthly_2018_production, jul_monthly_2018_production, aug_monthly_2018_production, sep_monthly_2018_production, oct_monthly_2018_production, nov_monthly_2018_production, dec_monthly_2018_production)
jan2019_production_1 <- production_raw_data %>% filter(grepl("01.2019", tarih))
jan_daily_2019_production <- ddply(jan2019_production_1,"tarih",numcolwise(sum))
January_2019_Production <- colSums(Filter(is.numeric, jan2019_production_1))
jan_monthly_2019_production <- as.data.frame(January_2019_Production)
feb2019_production_1 <- production_raw_data %>% filter(grepl("02.2019", tarih))
feb_daily_2019_production <- ddply(feb2019_production_1,"tarih",numcolwise(sum))
February_2019_Production <- colSums(Filter(is.numeric, feb2019_production_1))
feb_monthly_2019_production <- as.data.frame(February_2019_Production)
mar2019_production_1 <- production_raw_data %>% filter(grepl("03.2019", tarih))
mar_daily_2019_production <- ddply(jan2019_production_1,"tarih",numcolwise(sum))
March_2019_Production <- colSums(Filter(is.numeric, mar2019_production_1))
mar_monthly_2019_production <- as.data.frame(March_2019_Production)
apr2019_production_1 <- production_raw_data %>% filter(grepl("04.2019", tarih))
apr_daily_2019_production <- ddply(apr2019_production_1,"tarih",numcolwise(sum))
April_2019_Production <- colSums(Filter(is.numeric, apr2019_production_1))
apr_monthly_2019_production <- as.data.frame(April_2019_Production)
may2019_production_1 <- production_raw_data %>% filter(grepl("05.2019", tarih))
may_daily_2019_production <- ddply(may2019_production_1,"tarih",numcolwise(sum))
May_2019_Production <- colSums(Filter(is.numeric, may2019_production_1))
may_monthly_2019_production <- as.data.frame(May_2019_Production)
jun2019_production_1 <- production_raw_data %>% filter(grepl("06.2019", tarih))
jun_daily_2019_production <- ddply(jun2019_production_1,"tarih",numcolwise(sum))
June_2019_Production <- colSums(Filter(is.numeric, jun2019_production_1))
jun_monthly_2019_production <- as.data.frame(June_2019_Production)
jul2019_production_1 <- production_raw_data %>% filter(grepl("07.2019", tarih))
jul_daily_2019_production <- ddply(jul2019_production_1,"tarih",numcolwise(sum))
July_2019_Production <- colSums(Filter(is.numeric, jul2019_production_1))
jul_monthly_2019_production <- as.data.frame(July_2019_Production)
aug2019_production_1 <- production_raw_data %>% filter(grepl("08.2019", tarih))
aug_daily_2019_production <- ddply(aug2019_production_1,"tarih",numcolwise(sum))
August_2019_Production <- colSums(Filter(is.numeric, aug2019_production_1))
aug_monthly_2019_production <- as.data.frame(August_2019_Production)
sep2019_production_1 <- production_raw_data %>% filter(grepl("09.2019", tarih))
sep_daily_2019_production <- ddply(sep2019_production_1,"tarih",numcolwise(sum))
September_2019_Production <- colSums(Filter(is.numeric, sep2019_production_1))
sep_monthly_2019_production <- as.data.frame(September_2019_Production)
oct2019_production_1 <- production_raw_data %>% filter(grepl("10.2019", tarih))
oct_daily_2019_production <- ddply(oct2019_production_1,"tarih",numcolwise(sum))
October_2019_Production <- colSums(Filter(is.numeric, oct2019_production_1))
oct_monthly_2019_production <- as.data.frame(October_2019_Production)
Production_2019_Monthly <- cbind(jan_monthly_2019_production, feb_monthly_2019_production, mar_monthly_2019_production, apr_monthly_2019_production, may_monthly_2019_production, jun_monthly_2019_production, jul_monthly_2019_production, aug_monthly_2019_production, sep_monthly_2019_production, oct_monthly_2019_production)
Production_Monthly <- cbind(Production_2016_Monthly, Production_2017_Monthly, Production_2018_Monthly, Production_2019_Monthly)
Production_Monthly <- rownames_to_column(Production_Monthly, var = "Sources")
head(Production_Monthly, 5)
##      Sources January_2016_Production February_2016_Production
## 1 toplam_mwh                23155072                 20639380
## 2  dogal_gaz                 8093942                  6851969
## 3    barajli                 4249679                  3283233
## 4     linyit                 3401925                  3112894
## 5     akarsu                 1271297                  1815672
##   March_2016_Production April_2016_Production May_2016_Production
## 1              21718680              20962513            21523232
## 2               6278424               6733069             6033318
## 3               4260896               4288169             4077205
## 4               3066094               2359898             2775400
## 5               2480136               2680860             2578332
##   June_2016_Production July_2016_Production August_2016_Production
## 1             22565419             23822010             25665544.7
## 2              7220660              7791337              9391728.4
## 3              4369125              4781437              4727174.2
## 4              3089750              2999672              3375908.5
## 5              1988281              1364404               864327.5
##   September_2016_Production October_2016_Production
## 1                20796022.7              21544666.4
## 2                 6736868.4               7652795.8
## 3                 3345712.7               3143770.6
## 4                 3075347.6               3396936.2
## 5                  811553.3                842419.5
##   November_2016_Production December_2016_Production
## 1               22337628.5               24534293.9
## 2                8409508.3                7144162.9
## 3                3020372.1                5184177.9
## 4                3597847.9                3616656.1
## 5                 701170.6                 814256.2
##   January_2017_Production February_2017_Production March_2017_Production
## 1              24947364.9               22428514.8              23476834
## 2               8016219.3                8272837.9               8151647
## 3               4666700.5                3336895.0               3614625
## 4               3579836.5                3148954.5               3113307
## 5                951509.6                 917218.3               2065849
##   April_2017_Production May_2017_Production June_2017_Production
## 1              22049564            22891991             22292781
## 2               7308624             7455195              7823828
## 3               4234511             4254923              3168411
## 4               2896861             2725475              3262895
## 5               2895314             3113303              2097080
##   July_2017_Production August_2017_Production September_2017_Production
## 1             27693424             27488692.2                23720681.4
## 2             11101426             10754008.7                 9940236.4
## 3              3640201              4080740.9                 3190453.6
## 4              3897502              3487902.6                 3441187.1
## 5              1080191               733469.4                  588883.7
##   October_2017_Production November_2017_Production
## 1                23269572               23975113.4
## 2                10302066               11127388.2
## 3                 1617151                1523110.1
## 4                 3426994                3422955.9
## 5                  732781                 689576.6
##   December_2017_Production January_2018_Production
## 1                 25620726                25867412
## 2                  8947506                 8997292
## 3                  3830230                 3081555
## 4                  3563265                 3611223
## 5                  1100089                 1440039
##   February_2018_Production March_2018_Production April_2018_Production
## 1                 22780047              24123981              22724977
## 2                  7602700               6400983               6449432
## 3                  2116045               3477068               3881656
## 4                  3511818               3781637               3629942
## 5                  1467235               2773322               2444078
##   May_2018_Production June_2018_Production July_2018_Production
## 1            22966980             22791619             28184206
## 2             5719984              6188257             10536514
## 3             3928364              3688506              4659082
## 4             3790457              3716589              3861405
## 5             2549600              1970266              1177233
##   August_2018_Production September_2018_Production October_2018_Production
## 1               26572192                24153563.0              22631786.7
## 2                7741403                 8731743.6               7972260.2
## 3                4608852                 2941657.8               1719619.2
## 4                3805940                 3602346.4               3964013.1
## 5                 961037                  716960.4                713009.1
##   November_2018_Production December_2018_Production
## 1               23263984.7                 25109988
## 2                6835145.3                  6909485
## 3                2793663.8                  3989790
## 4                3753052.6                  3792709
## 5                 784830.1                  1833282
##   January_2019_Production February_2019_Production March_2019_Production
## 1                25316677                 22586095              23742549
## 2                 5402002                  3564382               4255045
## 3                 5457724                  5032233               5067975
## 4                 3561409                  3403311               3752697
## 5                 2186762                  2133259               2635838
##   April_2019_Production May_2019_Production June_2019_Production
## 1              22560958            23533417             22982158
## 2               3118247             2929235              2983887
## 3               6472982             7638109              7184776
## 4               3488619             3596315              3562551
## 5               3496262             3950646              2416971
##   July_2019_Production August_2019_Production September_2019_Production
## 1             27345793               26371678                24070913.5
## 2              6004182                5251413                 4964063.0
## 3              6122945                5816563                 4744346.5
## 4              4472509                4310660                 3995839.9
## 5              1506393                1131778                  937791.3
##   October_2019_Production
## 1              22830884.2
## 2               4786532.3
## 3               4300453.0
## 4               4174461.7
## 5                807494.3

Creating Monthly Sums for Consumption

jan2016_consumption_1 <- consumption_raw_data %>% filter(grepl("01.2016", tarih))
jan_daily_2016_consumption <- ddply(jan2016_consumption_1,"tarih",numcolwise(sum))
January_2016_Consumption <- colSums(Filter(is.numeric, jan2016_consumption_1))
jan_monthly_2016_consumption <- as.data.frame(January_2016_Consumption)
feb2016_consumption_1 <- consumption_raw_data %>% filter(grepl("02.2016", tarih))
feb_daily_2016_consumption <- ddply(feb2016_consumption_1,"tarih",numcolwise(sum))
February_2016_Consumption <- colSums(Filter(is.numeric, feb2016_consumption_1))
feb_monthly_2016_consumption <- as.data.frame(February_2016_Consumption)
mar2016_consumption_1 <- consumption_raw_data %>% filter(grepl("03.2016", tarih))
mar_daily_2016_consumption <- ddply(jan2016_consumption_1,"tarih",numcolwise(sum))
March_2016_Consumption <- colSums(Filter(is.numeric, mar2016_consumption_1))
mar_monthly_2016_consumption <- as.data.frame(March_2016_Consumption)
apr2016_consumption_1 <- consumption_raw_data %>% filter(grepl("04.2016", tarih))
apr_daily_2016_consumption <- ddply(apr2016_consumption_1,"tarih",numcolwise(sum))
April_2016_Consumption <- colSums(Filter(is.numeric, apr2016_consumption_1))
apr_monthly_2016_consumption <- as.data.frame(April_2016_Consumption)
may2016_consumption_1 <- consumption_raw_data %>% filter(grepl("05.2016", tarih))
may_daily_2016_consumption <- ddply(may2016_consumption_1,"tarih",numcolwise(sum))
May_2016_Consumption <- colSums(Filter(is.numeric, may2016_consumption_1))
may_monthly_2016_consumption <- as.data.frame(May_2016_Consumption)
jun2016_consumption_1 <- consumption_raw_data %>% filter(grepl("06.2016", tarih))
jun_daily_2016_consumption <- ddply(jun2016_consumption_1,"tarih",numcolwise(sum))
June_2016_Consumption <- colSums(Filter(is.numeric, jun2016_consumption_1))
jun_monthly_2016_consumption <- as.data.frame(June_2016_Consumption)
jul2016_consumption_1 <- consumption_raw_data %>% filter(grepl("07.2016", tarih))
jul_daily_2016_consumption <- ddply(jul2016_consumption_1,"tarih",numcolwise(sum))
July_2016_Consumption <- colSums(Filter(is.numeric, jul2016_consumption_1))
jul_monthly_2016_consumption <- as.data.frame(July_2016_Consumption)
aug2016_consumption_1 <- consumption_raw_data %>% filter(grepl("08.2016", tarih))
aug_daily_2016_consumption <- ddply(aug2016_consumption_1,"tarih",numcolwise(sum))
August_2016_Consumption <- colSums(Filter(is.numeric, aug2016_consumption_1))
aug_monthly_2016_consumption <- as.data.frame(August_2016_Consumption)
sep2016_consumption_1 <- consumption_raw_data %>% filter(grepl("09.2016", tarih))
sep_daily_2016_consumption <- ddply(sep2016_consumption_1,"tarih",numcolwise(sum))
September_2016_Consumption <- colSums(Filter(is.numeric, sep2016_consumption_1))
sep_monthly_2016_consumption <- as.data.frame(September_2016_Consumption)
oct2016_consumption_1 <- consumption_raw_data %>% filter(grepl("10.2016", tarih))
oct_daily_2016_consumption <- ddply(oct2016_consumption_1,"tarih",numcolwise(sum))
October_2016_Consumption <- colSums(Filter(is.numeric, oct2016_consumption_1))
oct_monthly_2016_consumption <- as.data.frame(October_2016_Consumption)
nov2016_consumption_1 <- consumption_raw_data %>% filter(grepl("11.2016", tarih))
nov_daily_2016_consumption <- ddply(nov2016_consumption_1,"tarih",numcolwise(sum))
November_2016_Consumption <- colSums(Filter(is.numeric, nov2016_consumption_1))
nov_monthly_2016_consumption <- as.data.frame(November_2016_Consumption)
dec2016_consumption_1 <- consumption_raw_data %>% filter(grepl("12.2016", tarih))
dec_daily_2016_consumption <- ddply(dec2016_consumption_1,"tarih",numcolwise(sum))
December_2016_Consumption <- colSums(Filter(is.numeric, dec2016_consumption_1))
dec_monthly_2016_consumption <- as.data.frame(December_2016_Consumption)
Consumption_2016_Monthly <- cbind(jan_monthly_2016_consumption, feb_monthly_2016_consumption, mar_monthly_2016_consumption, apr_monthly_2016_consumption, may_monthly_2016_consumption, jun_monthly_2016_consumption, jul_monthly_2016_consumption, aug_monthly_2016_consumption, sep_monthly_2016_consumption, oct_monthly_2016_consumption, nov_monthly_2016_consumption, dec_monthly_2016_consumption)
jan2017_consumption_1 <- consumption_raw_data %>% filter(grepl("01.2017", tarih))
jan_daily_2017_consumption <- ddply(jan2017_consumption_1,"tarih",numcolwise(sum))
January_2017_Consumption <- colSums(Filter(is.numeric, jan2017_consumption_1))
jan_monthly_2017_consumption <- as.data.frame(January_2017_Consumption)
feb2017_consumption_1 <- consumption_raw_data %>% filter(grepl("02.2017", tarih))
feb_daily_2017_consumption <- ddply(feb2017_consumption_1,"tarih",numcolwise(sum))
February_2017_Consumption <- colSums(Filter(is.numeric, feb2017_consumption_1))
feb_monthly_2017_consumption <- as.data.frame(February_2017_Consumption)
mar2017_consumption_1 <- consumption_raw_data %>% filter(grepl("03.2017", tarih))
mar_daily_2017_consumption <- ddply(jan2017_consumption_1,"tarih",numcolwise(sum))
March_2017_Consumption <- colSums(Filter(is.numeric, mar2017_consumption_1))
mar_monthly_2017_consumption <- as.data.frame(March_2017_Consumption)
apr2017_consumption_1 <- consumption_raw_data %>% filter(grepl("04.2017", tarih))
apr_daily_2017_consumption <- ddply(apr2017_consumption_1,"tarih",numcolwise(sum))
April_2017_Consumption <- colSums(Filter(is.numeric, apr2017_consumption_1))
apr_monthly_2017_consumption <- as.data.frame(April_2017_Consumption)
may2017_consumption_1 <- consumption_raw_data %>% filter(grepl("05.2017", tarih))
may_daily_2017_consumption <- ddply(may2017_consumption_1,"tarih",numcolwise(sum))
May_2017_Consumption <- colSums(Filter(is.numeric, may2017_consumption_1))
may_monthly_2017_consumption <- as.data.frame(May_2017_Consumption)
jun2017_consumption_1 <- consumption_raw_data %>% filter(grepl("06.2017", tarih))
jun_daily_2017_consumption <- ddply(jun2017_consumption_1,"tarih",numcolwise(sum))
June_2017_Consumption <- colSums(Filter(is.numeric, jun2017_consumption_1))
jun_monthly_2017_consumption <- as.data.frame(June_2017_Consumption)
jul2017_consumption_1 <- consumption_raw_data %>% filter(grepl("07.2017", tarih))
jul_daily_2017_consumption <- ddply(jul2017_consumption_1,"tarih",numcolwise(sum))
July_2017_Consumption <- colSums(Filter(is.numeric, jul2017_consumption_1))
jul_monthly_2017_consumption <- as.data.frame(July_2017_Consumption)
aug2017_consumption_1 <- consumption_raw_data %>% filter(grepl("08.2017", tarih))
aug_daily_2017_consumption <- ddply(aug2017_consumption_1,"tarih",numcolwise(sum))
August_2017_Consumption <- colSums(Filter(is.numeric, aug2017_consumption_1))
aug_monthly_2017_consumption <- as.data.frame(August_2017_Consumption)
sep2017_consumption_1 <- consumption_raw_data %>% filter(grepl("09.2017", tarih))
sep_daily_2017_consumption <- ddply(sep2017_consumption_1,"tarih",numcolwise(sum))
September_2017_Consumption <- colSums(Filter(is.numeric, sep2017_consumption_1))
sep_monthly_2017_consumption <- as.data.frame(September_2017_Consumption)
oct2017_consumption_1 <- consumption_raw_data %>% filter(grepl("10.2017", tarih))
oct_daily_2017_consumption <- ddply(oct2017_consumption_1,"tarih",numcolwise(sum))
October_2017_Consumption <- colSums(Filter(is.numeric, oct2017_consumption_1))
oct_monthly_2017_consumption <- as.data.frame(October_2017_Consumption)
nov2017_consumption_1 <- consumption_raw_data %>% filter(grepl("11.2017", tarih))
nov_daily_2017_consumption <- ddply(nov2017_consumption_1,"tarih",numcolwise(sum))
November_2017_Consumption <- colSums(Filter(is.numeric, nov2017_consumption_1))
nov_monthly_2017_consumption <- as.data.frame(November_2017_Consumption)
dec2017_consumption_1 <- consumption_raw_data %>% filter(grepl("12.2017", tarih))
dec_daily_2017_consumption <- ddply(dec2017_consumption_1,"tarih",numcolwise(sum))
December_2017_Consumption <- colSums(Filter(is.numeric, dec2017_consumption_1))
dec_monthly_2017_consumption <- as.data.frame(December_2017_Consumption)
Consumption_2017_Monthly <- cbind(jan_monthly_2017_consumption, feb_monthly_2017_consumption, mar_monthly_2017_consumption, apr_monthly_2017_consumption, may_monthly_2017_consumption, jun_monthly_2017_consumption, jul_monthly_2017_consumption, aug_monthly_2017_consumption, sep_monthly_2017_consumption, oct_monthly_2017_consumption, nov_monthly_2017_consumption, dec_monthly_2017_consumption)
jan2018_consumption_1 <- consumption_raw_data %>% filter(grepl("01.2018", tarih))
jan_daily_2018_consumption <- ddply(jan2018_consumption_1,"tarih",numcolwise(sum))
January_2018_Consumption <- colSums(Filter(is.numeric, jan2018_consumption_1))
jan_monthly_2018_consumption <- as.data.frame(January_2018_Consumption)
feb2018_consumption_1 <- consumption_raw_data %>% filter(grepl("02.2018", tarih))
feb_daily_2018_consumption <- ddply(feb2018_consumption_1,"tarih",numcolwise(sum))
February_2018_Consumption <- colSums(Filter(is.numeric, feb2018_consumption_1))
feb_monthly_2018_consumption <- as.data.frame(February_2018_Consumption)
mar2018_consumption_1 <- consumption_raw_data %>% filter(grepl("03.2018", tarih))
mar_daily_2018_consumption <- ddply(jan2018_consumption_1,"tarih",numcolwise(sum))
March_2018_Consumption <- colSums(Filter(is.numeric, mar2018_consumption_1))
mar_monthly_2018_consumption <- as.data.frame(March_2018_Consumption)
apr2018_consumption_1 <- consumption_raw_data %>% filter(grepl("04.2018", tarih))
apr_daily_2018_consumption <- ddply(apr2018_consumption_1,"tarih",numcolwise(sum))
April_2018_Consumption <- colSums(Filter(is.numeric, apr2018_consumption_1))
apr_monthly_2018_consumption <- as.data.frame(April_2018_Consumption)
may2018_consumption_1 <- consumption_raw_data %>% filter(grepl("05.2018", tarih))
may_daily_2018_consumption <- ddply(may2018_consumption_1,"tarih",numcolwise(sum))
May_2018_Consumption <- colSums(Filter(is.numeric, may2018_consumption_1))
may_monthly_2018_consumption <- as.data.frame(May_2018_Consumption)
jun2018_consumption_1 <- consumption_raw_data %>% filter(grepl("06.2018", tarih))
jun_daily_2018_consumption <- ddply(jun2018_consumption_1,"tarih",numcolwise(sum))
June_2018_Consumption <- colSums(Filter(is.numeric, jun2018_consumption_1))
jun_monthly_2018_consumption <- as.data.frame(June_2018_Consumption)
jul2018_consumption_1 <- consumption_raw_data %>% filter(grepl("07.2018", tarih))
jul_daily_2018_consumption <- ddply(jul2018_consumption_1,"tarih",numcolwise(sum))
July_2018_Consumption <- colSums(Filter(is.numeric, jul2018_consumption_1))
jul_monthly_2018_consumption <- as.data.frame(July_2018_Consumption)
aug2018_consumption_1 <- consumption_raw_data %>% filter(grepl("08.2018", tarih))
aug_daily_2018_consumption <- ddply(aug2018_consumption_1,"tarih",numcolwise(sum))
August_2018_Consumption <- colSums(Filter(is.numeric, aug2018_consumption_1))
aug_monthly_2018_consumption <- as.data.frame(August_2018_Consumption)
sep2018_consumption_1 <- consumption_raw_data %>% filter(grepl("09.2018", tarih))
sep_daily_2018_consumption <- ddply(sep2018_consumption_1,"tarih",numcolwise(sum))
September_2018_Consumption <- colSums(Filter(is.numeric, sep2018_consumption_1))
sep_monthly_2018_consumption <- as.data.frame(September_2018_Consumption)
oct2018_consumption_1 <- consumption_raw_data %>% filter(grepl("10.2018", tarih))
oct_daily_2018_consumption <- ddply(oct2018_consumption_1,"tarih",numcolwise(sum))
October_2018_Consumption <- colSums(Filter(is.numeric, oct2018_consumption_1))
oct_monthly_2018_consumption <- as.data.frame(October_2018_Consumption)
nov2018_consumption_1 <- consumption_raw_data %>% filter(grepl("11.2018", tarih))
nov_daily_2018_consumption <- ddply(nov2018_consumption_1,"tarih",numcolwise(sum))
November_2018_Consumption <- colSums(Filter(is.numeric, nov2018_consumption_1))
nov_monthly_2018_consumption <- as.data.frame(November_2018_Consumption)
dec2018_consumption_1 <- consumption_raw_data %>% filter(grepl("12.2018", tarih))
dec_daily_2018_consumption <- ddply(dec2018_consumption_1,"tarih",numcolwise(sum))
December_2018_Consumption <- colSums(Filter(is.numeric, dec2018_consumption_1))
dec_monthly_2018_consumption <- as.data.frame(December_2018_Consumption)
Consumption_2018_Monthly <- cbind(jan_monthly_2018_consumption, feb_monthly_2018_consumption, mar_monthly_2018_consumption, apr_monthly_2018_consumption, may_monthly_2018_consumption, jun_monthly_2018_consumption, jul_monthly_2018_consumption, aug_monthly_2018_consumption, sep_monthly_2018_consumption, oct_monthly_2018_consumption, nov_monthly_2018_consumption, dec_monthly_2018_consumption)
jan2019_consumption_1 <- consumption_raw_data %>% filter(grepl("01.2019", tarih))
jan_daily_2019_consumption <- ddply(jan2019_consumption_1,"tarih",numcolwise(sum))
January_2019_Consumption <- colSums(Filter(is.numeric, jan2019_consumption_1))
jan_monthly_2019_consumption <- as.data.frame(January_2019_Consumption)
feb2019_consumption_1 <- consumption_raw_data %>% filter(grepl("02.2019", tarih))
feb_daily_2019_consumption <- ddply(feb2019_consumption_1,"tarih",numcolwise(sum))
February_2019_Consumption <- colSums(Filter(is.numeric, feb2019_consumption_1))
feb_monthly_2019_consumption <- as.data.frame(February_2019_Consumption)
mar2019_consumption_1 <- consumption_raw_data %>% filter(grepl("03.2019", tarih))
mar_daily_2019_consumption <- ddply(jan2019_consumption_1,"tarih",numcolwise(sum))
March_2019_Consumption <- colSums(Filter(is.numeric, mar2019_consumption_1))
mar_monthly_2019_consumption <- as.data.frame(March_2019_Consumption)
apr2019_consumption_1 <- consumption_raw_data %>% filter(grepl("04.2019", tarih))
apr_daily_2019_consumption <- ddply(apr2019_consumption_1,"tarih",numcolwise(sum))
April_2019_Consumption <- colSums(Filter(is.numeric, apr2019_consumption_1))
apr_monthly_2019_consumption <- as.data.frame(April_2019_Consumption)
may2019_consumption_1 <- consumption_raw_data %>% filter(grepl("05.2019", tarih))
may_daily_2019_consumption <- ddply(may2019_consumption_1,"tarih",numcolwise(sum))
May_2019_Consumption <- colSums(Filter(is.numeric, may2019_consumption_1))
may_monthly_2019_consumption <- as.data.frame(May_2019_Consumption)
jun2019_consumption_1 <- consumption_raw_data %>% filter(grepl("06.2019", tarih))
jun_daily_2019_consumption <- ddply(jun2019_consumption_1,"tarih",numcolwise(sum))
June_2019_Consumption <- colSums(Filter(is.numeric, jun2019_consumption_1))
jun_monthly_2019_consumption <- as.data.frame(June_2019_Consumption)
jul2019_consumption_1 <- consumption_raw_data %>% filter(grepl("07.2019", tarih))
jul_daily_2019_consumption <- ddply(jul2019_consumption_1,"tarih",numcolwise(sum))
July_2019_Consumption <- colSums(Filter(is.numeric, jul2019_consumption_1))
jul_monthly_2019_consumption <- as.data.frame(July_2019_Consumption)
aug2019_consumption_1 <- consumption_raw_data %>% filter(grepl("08.2019", tarih))
aug_daily_2019_consumption <- ddply(aug2019_consumption_1,"tarih",numcolwise(sum))
August_2019_Consumption <- colSums(Filter(is.numeric, aug2019_consumption_1))
aug_monthly_2019_consumption <- as.data.frame(August_2019_Consumption)
sep2019_consumption_1 <- consumption_raw_data %>% filter(grepl("09.2019", tarih))
sep_daily_2019_consumption <- ddply(sep2019_consumption_1,"tarih",numcolwise(sum))
September_2019_Consumption <- colSums(Filter(is.numeric, sep2019_consumption_1))
sep_monthly_2019_consumption <- as.data.frame(September_2019_Consumption)
oct2019_consumption_1 <- consumption_raw_data %>% filter(grepl("10.2019", tarih))
oct_daily_2019_consumption <- ddply(oct2019_consumption_1,"tarih",numcolwise(sum))
October_2019_Consumption <- colSums(Filter(is.numeric, oct2019_consumption_1))
oct_monthly_2019_consumption <- as.data.frame(October_2019_Consumption)
Consumption_2019_Monthly <- cbind(jan_monthly_2019_consumption, feb_monthly_2019_consumption, mar_monthly_2019_consumption, apr_monthly_2019_consumption, may_monthly_2019_consumption, jun_monthly_2019_consumption, jul_monthly_2019_consumption, aug_monthly_2019_consumption, sep_monthly_2019_consumption, oct_monthly_2019_consumption)
Consumption_Monthly <- cbind(Consumption_2016_Monthly, Consumption_2017_Monthly, Consumption_2018_Monthly, Consumption_2019_Monthly)
Consumption_Monthly <- rownames_to_column(Consumption_Monthly, var = "Sources")
head(Consumption_Monthly, 10)
##               Sources January_2016_Consumption February_2016_Consumption
## 1 tuketim_miktari_mwh                 23704522                  21153165
##   March_2016_Consumption April_2016_Consumption May_2016_Consumption
## 1               21535377               21301824             21900302
##   June_2016_Consumption July_2016_Consumption August_2016_Consumption
## 1              23051249              24369823                26268794
##   September_2016_Consumption October_2016_Consumption
## 1                   21233349                 21850083
##   November_2016_Consumption December_2016_Consumption
## 1                  22683005                  25161281
##   January_2017_Consumption February_2017_Consumption
## 1                 25102545                  22451554
##   March_2017_Consumption April_2017_Consumption May_2017_Consumption
## 1               23586499               21953360             22853967
##   June_2017_Consumption July_2017_Consumption August_2017_Consumption
## 1              22303718              27776318                27522377
##   September_2017_Consumption October_2017_Consumption
## 1                   23807834                 23161713
##   November_2017_Consumption December_2017_Consumption
## 1                  23860824                  25594468
##   January_2018_Consumption February_2018_Consumption
## 1                 25929477                  22844496
##   March_2018_Consumption April_2018_Consumption May_2018_Consumption
## 1               24145065               22785833             23195356
##   June_2018_Consumption July_2018_Consumption August_2018_Consumption
## 1              23005314              28265839                26637203
##   September_2018_Consumption October_2018_Consumption
## 1                   24212352                 22667044
##   November_2018_Consumption December_2018_Consumption
## 1                  23335700                  25147675
##   January_2019_Consumption February_2019_Consumption
## 1                 25368790                  22630356
##   March_2019_Consumption April_2019_Consumption May_2019_Consumption
## 1               23793919               22611101             23586529
##   June_2019_Consumption July_2019_Consumption August_2019_Consumption
## 1              23034664              27380774                26421503
##   September_2019_Consumption October_2019_Consumption
## 1                   24125766                 22890236
colnames(Planning_Monthly) <-  c('Sources', 'January_16', 'February_16', 'March_16', 'April_16', 'May_16', 'June_16', 'July_16', 'August_16', 'September_16', 'October_16', 'November_16', 'December_16', 'January_17', 'February_17', 'March_17', 'April_17', 'May_17', 'June_17', 'July_17', 'August_17', 'September_17', 'October_17', 'November_17', 'December_17', 'January_18', 'February_18', 'March_18', 'April_18', 'May_18', 'June_18', 'July_18', 'August_18', 'September_18', 'October_18', 'November_18', 'December_18', 'January_19', 'February_19', 'March_19', 'April_19', 'May_19', 'June_19', 'July_19', 'August_19', 'September_19', 'October_19')
colnames(Production_Monthly) <-  c('Sources', 'January_16', 'February_16', 'March_16', 'April_16', 'May_16', 'June_16', 'July_16', 'August_16', 'September_16', 'October_16', 'November_16', 'December_16', 'January_17', 'February_17', 'March_17', 'April_17', 'May_17', 'June_17', 'July_17', 'August_17', 'September_17', 'October_17', 'November_17', 'December_17', 'January_18', 'February_18', 'March_18', 'April_18', 'May_18', 'June_18', 'July_18', 'August_18', 'September_18', 'October_18', 'November_18', 'December_18', 'January_19', 'February_19', 'March_19', 'April_19', 'May_19', 'June_19', 'July_19', 'August_19', 'September_19', 'October_19')
colnames(Consumption_Monthly) <-  c('Sources', 'January_16', 'February_16', 'March_16', 'April_16', 'May_16', 'June_16', 'July_16', 'August_16', 'September_16', 'October_16', 'November_16', 'December_16', 'January_17', 'February_17', 'March_17', 'April_17', 'May_17', 'June_17', 'July_17', 'August_17', 'September_17', 'October_17', 'November_17', 'December_17', 'January_18', 'February_18', 'March_18', 'April_18', 'May_18', 'June_18', 'July_18', 'August_18', 'September_18', 'October_18', 'November_18', 'December_18', 'January_19', 'February_19', 'March_19', 'April_19', 'May_19', 'June_19', 'July_19', 'August_19', 'September_19', 'October_19')

4 Year Production Analysis: January 2016 - October 2019

production_yuzde <- round((colSums(Filter(is.numeric, production_raw_data))/sum(production_raw_data$toplam_mwh))*100, digits=2)
production_yuzde2 <- as.data.frame(production_yuzde)
production_yuzde2 <- rownames_to_column(production_yuzde2, var = "kaynaklar")
production_yuzde2 <- production_yuzde2 %>% slice(2:max(nrow(.))) %>% filter(kaynaklar !='toplam_mwh')
tail(production_yuzde2, 7)
##         kaynaklar production_yuzde
## 9       jeotermal             2.11
## 10 asfaltit_komur             0.87
## 11      tas_komur             1.00
## 12      biyokutle             0.76
## 13          nafta             0.00
## 14            lng             0.00
## 15   uluslararasi            -0.15
# Create Data
x <- c(330882954.42, 188612868.09, 160974973.37, 75212059.65, 208964232.22, 71168183.03, 233696.49, 5509051.71, 23037800.33, 9467418.70, 10905822.78, 8257603.48, 0.00, 49534.99)
labels <- c("dogal_gaz", "barajli", "linyit", "akarsu", "ithal_komur", "ruzgar", "gunes", "fuel_oil", "jeotermal", "asfaltit_komur","tas_komur", "biyokutle", "nafta", "lng" )
pct <- round((x/1091631578.02)*100, digits=2)
lbls <- paste(labels, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(x,labels = lbls, col=rainbow(length(lbls)),main="Ratio of Production Resources", cex=0.4)

4 Year Consumption Analysis: January 2016 - October 2019

Hourly consumption data was previously edited on a monthly basis, now we will first change the column headings to follow the consumption from the first month to the last month and then visualize.

colnames(Consumption_Monthly) <-  c('Sources', '2016_01', '2016_02', '2016_03', '2016_04', '2016_05', '2016_06', '2016_07', '2016_08', '2016_09', '2016_10', '2016_11', '2016_12', '2017_01', '2017_02', '2017_03', '2017_04', '2017_05', '2017_06', '2017_07', '2017_08', '2017_09', '2017_10', '2017_11', '2017_12', '2018_01', '2018_02', '2018_03', '2018_04', '2018_05', '2018_06', '2018_07', '2018_08', '2018_09', '2018_10', '2018_11', '2018_12', '2019_01', '2019_02', '2019_03', '2019_04', '2019_05', '2019_06', '2019_07', '2019_08', '2019_09','2019_10')

cons_plot<- gather(Consumption_Monthly, key = "months", value = "tuketim_miktari_mwh")
cons_plot<- slice(cons_plot,2:47)

cons_plot
##     months tuketim_miktari_mwh
## 1  2016_01         23704521.96
## 2  2016_02         21153164.88
## 3  2016_03         21535376.75
## 4  2016_04         21301823.68
## 5  2016_05         21900302.38
## 6  2016_06         23051248.67
## 7  2016_07         24369823.16
## 8  2016_08         26268794.29
## 9  2016_09         21233349.41
## 10 2016_10         21850083.46
## 11 2016_11          22683004.9
## 12 2016_12         25161281.04
## 13 2017_01         25102545.03
## 14 2017_02         22451554.33
## 15 2017_03         23586498.72
## 16 2017_04         21953359.53
## 17 2017_05         22853967.13
## 18 2017_06         22303718.02
## 19 2017_07         27776317.83
## 20 2017_08         27522377.03
## 21 2017_09         23807834.45
## 22 2017_10          23161713.2
## 23 2017_11         23860824.05
## 24 2017_12         25594467.72
## 25 2018_01         25929476.87
## 26 2018_02         22844495.53
## 27 2018_03         24145064.93
## 28 2018_04         22785832.63
## 29 2018_05         23195355.53
## 30 2018_06         23005314.26
## 31 2018_07         28265838.77
## 32 2018_08         26637202.76
## 33 2018_09         24212352.27
## 34 2018_10         22667043.67
## 35 2018_11         23335700.06
## 36 2018_12         25147674.77
## 37 2019_01         25368789.54
## 38 2019_02         22630356.02
## 39 2019_03          23793919.1
## 40 2019_04         22611100.88
## 41 2019_05         23586528.82
## 42 2019_06         23034663.55
## 43 2019_07          27380774.5
## 44 2019_08         26421503.29
## 45 2019_09         24125765.67
## 46 2019_10         22890236.13
ggplot(cons_plot, aes(x=cons_plot$months, y=cons_plot$tuketim_miktari_mwh)) + 
  geom_bar(stat = "identity", width=0.2)

As you can see from the plot, there is a seasonal effect on consumption: In the summer, consumption increases every year!

We now reinstate column headings for further analysis.

colnames(Consumption_Monthly) <-  c('Sources','January_16', 'February_16', 'March_16', 'April_16', 'May_16', 'June_16', 'July_16', 'August_16', 'September_16', 'October_16', 'November_16', 'December_16',
                                    'January_17', 'February_17', 'March_17', 'April_17', 'May_17', 'June_17', 'July_17', 'August_17', 'September_17', 'October_17', 'November_17', 'December_17',
                                    'January_18', 'February_18', 'March_18', 'April_18', 'May_18', 'June_18', 'July_18', 'August_18', 'September_18', 'October_18', 'November_18', 'December_18',
                                    'January_19', 'February_19', 'March_19', 'April_19', 'May_19', 'June_19', 'July_19', 'August_19', 'September_19', 'October_19')

Comparison of Planning and Actual Production

When the data obtained since 2016 are analyzed, it is seen that the actual production is above the planned production in the whole process.

While there are significant differences between the two values in the first 4 months of 2016, it is observed that these differences have decreased in the continuation of the process.

Comparison of Total Planned Production (MWh) and Total Actual Production (MWh)

Plan_MT <- subset(Planning_Monthly, Sources=="toplam_mwh")
Plan_MT <- as.data.frame(transpose(Plan_MT))
Prod_MT <- subset(Production_Monthly, Sources=="toplam_mwh")
Prod_MT <- as.data.frame(transpose(Prod_MT))
CompPlanProd <- cbind(Plan_MT, Prod_MT)
colnames(CompPlanProd) <- c('Planned_Production', 'Actual_Production') 
CompPlanProd <- CompPlanProd[-1,]
CompPlanProd$Dates <-  c('16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
CompPlanProd$Planned_Production <-as.numeric(CompPlanProd$Planned_Production)
CompPlanProd$Actual_Production <-as.numeric(CompPlanProd$Actual_Production)
head(CompPlanProd, 5)
##   Planned_Production Actual_Production Dates
## 2           18385705          23155072 16_01
## 3           16370338          20639380 16_02
## 4           18588231          21718680 16_03
## 5           18356083          20962513 16_04
## 6           19877153          21523232 16_05
library(ggplot2)
library(reshape2)
## 
## Attaching package: 'reshape2'
## The following objects are masked from 'package:data.table':
## 
##     dcast, melt
## The following object is masked from 'package:tidyr':
## 
##     smiths
G_CompPlanProd <- melt(CompPlanProd, id.vars="Dates")
ggplot(G_CompPlanProd, aes(value/1000000, Dates, col=variable)) + 
  geom_point() + 
  stat_smooth() +
  geom_line( color="grey") +
labs(title="Comparison of Planned and Actual Productions", 
       subtitle="Production in MWh (and x1M)",
     x="Production (MWh) (x1M)",
     y="Dates",
     col="Planned vs Actual") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

CompPlanProd_2<-data.frame(CompPlanProd)
CompPlanProd_2$Difference <- (CompPlanProd_2$Actual_Production - CompPlanProd_2$Planned_Production)/1000000
CompPlanProdDiff <- CompPlanProd_2 %>% select(Dates, Difference)
CompPlanProdDiff <- CompPlanProdDiff %>% 
  mutate(mycolor = ifelse(CompPlanProdDiff$Difference>0, "type1", "type2"))
ggplot(CompPlanProdDiff, aes(x=CompPlanProdDiff$Dates, y=CompPlanProdDiff$Difference)) +
  geom_segment( aes(x=CompPlanProdDiff$Dates, xend=CompPlanProdDiff$Dates, y=0, yend=CompPlanProdDiff$Difference, color=mycolor), size=1.3, alpha=0.9) +
  theme_light() +
  theme(
    legend.position = "none",
    panel.border = element_blank(),
  ) +
  xlab("Dates") +
  ylab("Actual Production - Planned Production (MWh) (x1M)")

Comparison of Planned Production (MWh) and Actual Production (MWh) for Sources

Production_Monthly_Trp <- as.data.frame(transpose(Production_Monthly))
colnames(Production_Monthly_Trp) <- c('toplam_mwh', 'dogal_gaz',    'barajli',  'linyit',   'akarsu',   'ithal_komur',  'ruzgar',   'gunes',    'fuel_oil', 'jeotermal',    'asfaltit_komur',   'tas_komur',    'biyokutle',    'nafta',    'lng',  'uluslararasi')
Production_Monthly_Trp[] <- lapply(Production_Monthly_Trp, function(x) as.numeric(as.character(x)))
Production_Monthly_Trp$Dates <-  c('Sources', '16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
Production_Monthly_Trp <- Production_Monthly_Trp[-1,]
Production_Monthly_Trp <- Production_Monthly_Trp[,-1]
head(Production_Monthly_Trp,5)
##   dogal_gaz barajli  linyit  akarsu ithal_komur    ruzgar gunes fuel_oil
## 2   8093942 4249679 3401925 1271297     3728569 1256556.7     0 153842.2
## 3   6851969 3283233 3112894 1815672     3441797 1136751.9     0 131466.9
## 4   6278424 4260896 3066094 2480136     3252120 1248335.7     0 155338.7
## 5   6733069 4288169 2359898 2680860     2999844  816274.5     0 159601.7
## 6   6033318 4077205 2775400 2578332     4035879  923452.2     0 156074.2
##   jeotermal asfaltit_komur tas_komur biyokutle nafta     lng uluslararasi
## 2  351444.9       271455.7  249304.5  120657.8     0 6398.32            0
## 3  327393.8       223096.4  191865.0  117012.6     0 6227.85            0
## 4  357303.4       253712.2  232404.0  127375.7     0 6539.90            0
## 5  332710.6       226864.7  236477.0  122834.8     0 5909.81            0
## 6  347485.5       252689.2  211254.5  125607.5     0 6533.56            0
##   Dates
## 2 16_01
## 3 16_02
## 4 16_03
## 5 16_04
## 6 16_05
Planning_Monthly_Trp <- as.data.frame(transpose(Planning_Monthly))
colnames(Planning_Monthly_Trp) <- c('toplam_mwh',   'dogal_gaz',    'ruzgar',   'linyit',   'tas_komur',    'ithal_komur', 'fuel_oil', 'jeotermal', 'barajli',  'nafta', 'biyokutle',   'akarsu',   'diger')
Planning_Monthly_Trp[] <- lapply(Planning_Monthly_Trp, function(x) as.numeric(as.character(x)))
Planning_Monthly_Trp$Dates <-  c('Sources', '16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
Planning_Monthly_Trp <- Planning_Monthly_Trp[-1,]
Planning_Monthly_Trp <- Planning_Monthly_Trp[,-1]
head(Planning_Monthly_Trp,5)
##   dogal_gaz    ruzgar  linyit tas_komur ithal_komur fuel_oil jeotermal
## 2   6956584  97156.52 2785761    553672     3326572 415328.6  45185.60
## 3   5751947 125460.91 2562705    530251     3121218 522803.0  23687.55
## 4   5427182 618063.48 2419857    630380     2930062 266379.0 195261.82
## 5   6086039 487208.62 1794658    554156     2599052  92350.7 194474.33
## 6   5080387 705477.80 2189356    575697     3544970  90112.0 288480.61
##   barajli  nafta biyokutle    akarsu    diger Dates
## 2 3770299 3456.0    267.00  189367.4 242055.7 16_01
## 3 3146464 3124.3   1811.90  354320.6 226544.1 16_02
## 4 4574145 3393.7  31748.90 1251710.1 240048.0 16_03
## 5 4780549 3200.2  38345.52 1515080.7 210968.4 16_04
## 6 4940352 3263.0  56677.03 2168194.0 234186.8 16_05
PlanProdSources <- as.data.frame(c(1:46))
PlanProdSources$Dates <- Planning_Monthly_Trp$Dates
PlanProdSources$Barajli <- (Production_Monthly_Trp$barajli - Planning_Monthly_Trp$barajli)
PlanProdSources$Linyit <- (Production_Monthly_Trp$linyit - Planning_Monthly_Trp$linyit)
PlanProdSources$Akarsu <- (Production_Monthly_Trp$akarsu - Planning_Monthly_Trp$akarsu)
PlanProdSources$Ithal_Komur <- (Production_Monthly_Trp$ithal_komur - Planning_Monthly_Trp$ithal_komur)
PlanProdSources$Ruzgar <- (Production_Monthly_Trp$ruzgar - Planning_Monthly_Trp$ruzgar)
PlanProdSources$Fuel_Oil <- (Production_Monthly_Trp$fuel_oil - Planning_Monthly_Trp$fuel_oil)
PlanProdSources$Jeotermal <- (Production_Monthly_Trp$jeotermal - Planning_Monthly_Trp$jeotermal)
PlanProdSources$Taskomur <- (Production_Monthly_Trp$tas_komur - Planning_Monthly_Trp$tas_komur)
PlanProdSources$Biyokutle <- (Production_Monthly_Trp$biyokutle - Planning_Monthly_Trp$biyokutle)
PlanProdSources <- PlanProdSources[,-1]
head(PlanProdSources,5)
##   Dates   Barajli   Linyit    Akarsu Ithal_Komur    Ruzgar   Fuel_Oil
## 1 16_01  479380.2 616163.6 1081929.4    401996.9 1159400.2 -261486.43
## 2 16_02  136768.4 550189.7 1461351.4    320578.6 1011291.0 -391336.07
## 3 16_03 -313248.2 646237.0 1228425.6    322058.1  630272.2 -111040.33
## 4 16_04 -492380.7 565239.7 1165779.3    400791.9  329065.9   67250.98
## 5 16_05 -863147.0 586044.8  410138.1    490908.7  217974.4   65962.16
##   Jeotermal  Taskomur Biyokutle
## 1 306259.34 -304367.5 120390.76
## 2 303706.25 -338386.0 115200.66
## 3 162041.57 -397976.0  95626.83
## 4 138236.29 -317679.0  84489.25
## 5  59004.85 -364442.5  68930.46

When the differences between actual production and planned production values are analyzed by source; It is seen that there are no significant differences between the two values in Geothermal, Biomass, Fuel Oil sources, but there are differences between plan and production in sources such as Dams, Stream and Lignite.

library(ggplot2)
library(reshape2)
G_PlanProdSources <- melt(PlanProdSources, id.vars="Dates")
colnames(G_PlanProdSources) <- c('Dates',   'Source',   'Prod_Plan_Difference')
ggplot(data = G_PlanProdSources, aes(x = Dates , y = Prod_Plan_Difference/1000000, group = 1)) +
    geom_line() +
    facet_wrap(~ Source) +
    labs(subtitle = "Difference Between Actual Production and Planned Production by Sources", y="Actual Production - Planned Production (MWh) (x1M)", x="Dates")

Comparison of Production and Consumption

When real production and consumption values are compared, it is seen that consumption values are higher than production values. In the 46-month period from the beginning of 2016 to October 2019, it was found that only 6 months (listed below) Production value was higher than Consumption value and consumption was higher than production in all remaining months;

Con_MT <- subset(Consumption_Monthly, Sources=="tuketim_miktari_mwh")
Con_MT <- as.data.frame(transpose(Con_MT))
CompProdCon <- cbind(Prod_MT, Con_MT)
colnames(CompProdCon) <- c('Actual_Production', 'Consumption')
CompProdCon <- CompProdCon[-1,]
CompProdCon$Dates <-  c('16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
CompProdCon$Actual_Production <-as.numeric(CompProdCon$Actual_Production)
CompProdCon$Consumption <-as.numeric(CompProdCon$Consumption)
head(CompProdCon,5)
##   Actual_Production Consumption Dates
## 2          23155072    23704522 16_01
## 3          20639380    21153165 16_02
## 4          21718680    21535377 16_03
## 5          20962513    21301824 16_04
## 6          21523232    21900302 16_05
library(ggplot2)
library(reshape2)
G_CompProdCon <- melt(CompProdCon, id.vars="Dates")
ggplot(G_CompProdCon, aes(value/1000000, Dates, col=variable)) + 
  geom_point() + 
  stat_smooth() +
  geom_line( color="grey") +
labs(title="Comparison of Actual Production and Comsumption", 
       subtitle="in MWh (and x1M)",
     x="MWh (x1M)",
     y="Dates",
     col="Production vs Consumption") 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

CompProdCon_2<-data.frame(CompProdCon)
CompProdCon_2$Difference <- (CompProdCon_2$Actual_Production - CompProdCon_2$Consumption)/1000000
CompProdConDiff <- CompProdCon_2 %>% select(Dates, Difference)
head(CompProdConDiff, 5)
##   Dates Difference
## 2 16_01 -0.5494502
## 3 16_02 -0.5137849
## 4 16_03  0.1833031
## 5 16_04 -0.3393110
## 6 16_05 -0.3770707
CompProdConDiff <- CompProdConDiff %>% 
  mutate(mycolor = ifelse(CompProdConDiff$Difference>0, "type1", "type2"))
ggplot(CompProdConDiff, aes(x=CompProdConDiff$Dates, y=CompProdConDiff$Difference)) +
  geom_segment( aes(x=CompProdConDiff$Dates, xend=CompProdConDiff$Dates, y=0, yend=CompProdConDiff$Difference, color=mycolor), size=1.3, alpha=0.9) +
  theme_light() +
  theme(
    legend.position = "none",
    panel.border = element_blank(),
  ) +
  xlab("Dates") +
  ylab("Production - Consumption (MWh) (x1M)")

Ratio of Renewable Energy Resources within 4 Years of Production

production_toplam <- colSums(Filter(is.numeric, production_raw_data))
print(production_toplam)
##     toplam_mwh      dogal_gaz        barajli         linyit         akarsu 
##  1091631578.02   330882954.42   188612868.09   160974973.37    75212059.65 
##    ithal_komur         ruzgar          gunes       fuel_oil      jeotermal 
##   208964232.22    71168183.03      233696.49     5509051.71    23037800.33 
## asfaltit_komur      tas_komur      biyokutle          nafta            lng 
##     9467418.70    10905822.78     8257603.48           0.00       49534.99 
##   uluslararasi 
##    -1644621.24
production_mwh <- colSums(Filter(is.numeric, production_raw_data))
production_mwh2 <- as.data.frame(production_mwh)
production_mwh2 <- rownames_to_column(production_mwh2, var = "kaynaklar")
production_mwh2 <- production_mwh2 %>% slice(2:max(nrow(.))) %>% filter(kaynaklar !='toplam_mwh')
tail(production_mwh2, 5)
##       kaynaklar production_mwh
## 11    tas_komur    10905822.78
## 12    biyokutle     8257603.48
## 13        nafta           0.00
## 14          lng       49534.99
## 15 uluslararasi    -1644621.24
library(ggplot2)
theme_set(theme_bw())
options(scipen=999)
# Draw plot
ggplot(production_mwh2, aes(x=kaynaklar, y=production_mwh)) + 
  geom_bar(stat="identity", width=.5, fill="tomato3") + 
  labs(title="Total Production Amount by Years (mwh)", 
       subtitle="Amount of Production from All Sources", 
       y = "Total Sources mwh",
       x = "Sources",
       caption="source: epiaÅŸ") + 
  theme(axis.text.x = element_text(angle=65, vjust=0.6))

renewable_energy <- colSums(Filter(is.numeric, production_raw_data))
renewable_energy <- as.data.frame(renewable_energy)
renewable_energy <- rownames_to_column(renewable_energy, var = "kaynaklar")
renewable_energy <- subset(renewable_energy, kaynaklar=="ruzgar" | kaynaklar=="gunes" | kaynaklar=="toplam_mwh")
print(renewable_energy)
##    kaynaklar renewable_energy
## 1 toplam_mwh     1091631578.0
## 7     ruzgar       71168183.0
## 8      gunes         233696.5
solar_stat <- as.data.frame(Production_Monthly_Trp$ruzgar)
solar_stat$Dates <-  c('16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
ggplot(solar_stat, aes(x=solar_stat$Dates, y=solar_stat$`Production_Monthly_Trp$ruzgar`)) + 
  geom_bar(stat = "identity", width=0.2) +
  labs(subtitle = "Production by Years", y="Solar (MWh)", x="Dates")

sun_stat <- as.data.frame(Production_Monthly_Trp$gunes)
sun_stat$Dates <-  c('16_01', '16_02', '16_03', '16_04', '16_05', '16_06', '16_07', '16_08', '16_09', '16_10', '16_11', '16_12', '17_01', '17_02', '17_03', '17_04', '17_05', '17_06', '17_07', '17_08', '17_09', '17_10', '17_11', '17_12', '18_01', '18_02', '18_03', '18_04', '18_05', '18_06', '18_07', '18_08', '18_09', '18_10', '18_11', '18_12', '19_01', '19_02', '19_03', '19_04', '19_05', '19_06', '19_07', '19_08', '19_09', '19_10')
ggplot(sun_stat, aes(x=sun_stat$Dates, y=sun_stat$`Production_Monthly_Trp$gunes`)) + 
  geom_bar(stat = "identity", width=0.2) +
  labs(subtitle = "Production by Years", y="Sun (MWh)", x="Dates")

# Create Data
x <- c(71168183.03, 233696.49)
labels <- c("ruzgar", "gunes")
pct <- round((x/1091631578.0)*100, digits = 2)
lbls <- paste(labels, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(x,labels = lbls, col=rainbow(length(lbls)),main="Ratio of Renewable Energy Resources Production", cex=0.5)

fossil_naturalgas <- colSums(Filter(is.numeric, production_raw_data))
fossil_naturalgas <- as.data.frame(fossil_naturalgas)
fossil_naturalgas <- rownames_to_column(fossil_naturalgas, var = "kaynaklar")
fossil_naturalgas <- subset(fossil_naturalgas, kaynaklar=="toplam_mwh" | kaynaklar=="dogal_gaz" | kaynaklar=="fuel_oil" | kaynaklar=="linyit" | kaynaklar=="ithal_komur" | kaynaklar=="asfaltit_komur" | kaynaklar=="tas_komur")
print(fossil_naturalgas)
##         kaynaklar fossil_naturalgas
## 1      toplam_mwh        1091631578
## 2       dogal_gaz         330882954
## 4          linyit         160974973
## 6     ithal_komur         208964232
## 9        fuel_oil           5509052
## 11 asfaltit_komur           9467419
## 12      tas_komur          10905823

Ratio of Fuel and Natural Gas Resources within 4 Years of Production

# Create Data
x <- c(330882954, 160974973, 208964232, 5509052, 9467419, 10905823)
labels <- c("dogal_gaz", "linyit", "ithal_komur", "fuel_oil", "asfaltit_komur", "tas_komur")
pct <- round((x/1091631578.0)*100, digits = 2)
lbls <- paste(labels, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(x,labels = lbls, col=rainbow(length(lbls)),main="Ratio of Fossil Fuel and Natural Gas Production", cex=0.4)

Conclusion