knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(power.usage.analysis) library(dplyr)
This vignette explains how to get data from elhub.no and prepare it in a way that makes it compatible with this package.
To download your personal power consumption data (provided you are in Norway), go to elhub.no, log on to "Min side", click "Se måleverdier", then "Last ned forbruksverdier", and select the month you wish to download data for.
The data from elhub.no will be given in one csv file per month. To merge the data, you can use the following command to merge the montly data into one data frame:
all_power_data <- file_names %>% lapply(function(i){read.csv(paste0("path_to_folder_with_files", i), dec = ",", header = TRUE)}) %>% dplyr::bind_rows()
The data in all_power_data
as created above should have the same structure as the data power_data
, which is included in this package.
head(power_data)
Lastly, we can make the data a bit easier so work with by formating the date, and adding the year, month, weekday and hour of each observation. This is done in the function clean_and_prepare
.
?clean_and_prepare
data <- clean_and_prepare(power_data)
head(data)
Now the data is ready for plotting!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.