I would like to create a histogram in R looking like this: Histogram count of 15 minutes interval of start and stopdates of weekend and weekdays
So a horizontal histogram that counts 15minutes (instead of the 20minutes in the picture) the start and stopdate of both the weekday and the weekend days.
I have been using the tips of Split time series data into time intervals (say an hour) and then plot the count, but I don't archieve to create the plot that I would like to have.
The dataset I have looks like this
DF < -Start_datetime End_datetime
2012-02-01 17:35:00 2012-02-01 17:43:44
2012-02-01 17:46:44 2012-03-01 17:50:44
2012-02-01 17:49:50 2012-02-01 18:49:54
2012-02-01 17:42:44 2012-03-01 08:10:44
This is what I tried (just to get the counting of the 15minutes interval done for the startdates):
PTU <- table (cut(DF$Start_datetime, breaks="15 minutes"))
data.frame(PTU)
ggplot(DF, aes(x=PTU))+
geom_histogram(sta="count", color="blue") +
labs(x = "Duration", y="Frequency")+
ggtitle("Duration of charging session")+
theme(plot.title = element_text(family="Roboto Light", size=16))+
theme(axis.title = element_text(family="Roboto Light", size=14))
This is the message that I receive:
Warning: Ignoring unknown parameters: binwidth, bins, pad
Error in eval(expr, envir, enclos) : object 'PTU' not found
In addition: There were 14 warnings (use warnings() to see them)
Is there anyone that can help me out to adjust the graph to a seperated one for weekdays/weekends and to properly count the intervals from the dates? Thanks a lot!