With the following code I can compute the yearly energy consumption:
library(zoo)
library(xts)
library(lubridate)
f <- function(d, t) parse_date_time(paste(d, t), "%d.%m.%Y %H:%M")
energy <- read.zoo("https://dl.dropboxusercontent.com/u/23293644/export-27-10-2014-21-22.csv",
header = TRUE, sep=";", dec=",",
index = 1:2,
FUN = function(d, t) parse_date_time(paste(d, t, sep = " "), "dmy hM")
)
energy_subset <- subset(energy, select = c(Stand.HT, Stand.NT))
yearly_grid_start <- as.Date((years(year(start(energy_subset)) - 1970 - 2) + months(month(9))))
yearly_grid_end <- as.Date(years(year(end(energy_subset)) - 1970 + 1))
yearly_grid <- seq(yearly_grid_start, yearly_grid_end, by="1 year")
yearly_energy <- na.approx(merge(xts(,yearly_grid),energy_subset))[yearly_grid]
yearly_energy <- transform(yearly_energy, Total = Stand.HT + Stand.NT)
ye <- diff(yearly_energy)
ye
The result shows shows that the energy consumption was 3534 kWh for the year 2013:
Stand.HT Stand.NT Total
2012-10-01 11546.89 11669.81 23216.70
2013-10-01 13467.20 13677.47 27144.67
2014-10-01 15127.20 15551.80 30679.00
>
Stand.HT Stand.NT Total
2013-10-01 1920.31 2007.657 3927.967
2014-10-01 1660.00 1874.333 3534.333
which is a bit higher than the 3453 kWh that I had on my yearly energy bill (01.10.2013 - 30.09.2014).
The diagram below shows the the trend of starting in 2009 till today (2014):
No comments:
Post a Comment