Electricity Market Prices

library(dplyr)
library(tidyverse)
library(ggplot2)
library(lubridate)
library(ggthemes)

electricity_prices <- read_csv("ptf-smf.csv" ,col_types = cols(Date = col_datetime(format = "%d.%m.%y %H:%M")))

glimpse(electricity_prices)
## Rows: 720
## Columns: 6
## $ Date                                <dttm> 2020-09-01 00:00:00, 2020-09-0...
## $ MCP                                 <dbl> 302.39, 300.25, 292.64, 290.00,...
## $ SMP                                 <dbl> 332.39, 325.25, 317.64, 320.00,...
## $ `Positive Imbalance Price (TL/MWh)` <dbl> 293.32, 291.24, 283.86, 281.30,...
## $ `Negative Imbalance Price (TL/MWh)` <dbl> 342.36, 335.01, 327.17, 329.60,...
## $ `SMP Direction`                     <chr> "? Energy Deficit", "? Energy D...
summary<-electricity_prices %>% mutate(dayss=lubridate::day(Date),hour = lubridate::hour(Date)) 

summary %>% group_by(dayss) %>% summarise(meanMCP=mean(MCP),meanSMP=mean(SMP)) %>%  ggplot(.,aes(x=dayss))+geom_line(aes(y=meanMCP,color="MCP"))+geom_line(aes(y=meanSMP,color="SMP"))+theme_economist() 

Including Plots

summary %>% group_by(hour) %>% summarise(meanMCP=mean(MCP),meanSMP=mean(SMP)) %>%  ggplot(.,aes(x=hour))+geom_line(aes(y=meanMCP,color="MCP"))+geom_line(aes(y=meanSMP,color="SMP"))+theme_economist() 
## `summarise()` ungrouping output (override with `.groups` argument)