Title: | Renders plots of medaco csv data |
---|---|
Description: | Plot power input and output. |
Authors: | Joerg Sesterhenn [aut, cre] |
Maintainer: | Joerg Sesterhenn <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-24 13:28:54 UTC |
Source: | https://github.com/joergsesterhenn/medaco-plot |
Retrieves a list of all .CSV
files in the specified directory.
get_files_in_path(data_path)
get_files_in_path(data_path)
data_path |
Character string specifying the directory path to search. |
A character vector of file paths for .CSV
files in the directory.
get_files_in_path("data/")
get_files_in_path("data/")
Aggregates and reshapes the data by hour, returning it in a long format.
get_hourly_data_long(power_data)
get_hourly_data_long(power_data)
power_data |
data frame with |
A data frame with hourly total_input
and total_output
values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_hourly_data_long(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_hourly_data_long(power_data)
Aggregates and reshapes the data by both hour and month, returning it.
get_hourly_monthly_data_long(power_data)
get_hourly_monthly_data_long(power_data)
power_data |
data frame with |
A data frame with hourly and monthly values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_hourly_monthly_data_long(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_hourly_monthly_data_long(power_data)
Aggregates and reshapes the data by month, returning it in a long format.
get_monthly_data_long(power_data)
get_monthly_data_long(power_data)
power_data |
data frame with |
A data frame with monthly total_input
and total_output
values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_monthly_data_long(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_monthly_data_long(power_data)
Aggregates and reshapes the data by year, returning it in a long format.
get_yearly_data_long(power_data)
get_yearly_data_long(power_data)
power_data |
data frame with |
A data frame with yearly total_input
and total_output
values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_monthly_data_long(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) get_monthly_data_long(power_data)
Transforms data from a wide format to a long format, creating separate rows
for total_input
and total_output
.
pivot_longer_data(power_data)
pivot_longer_data(power_data)
power_data |
data frame with |
A data frame in long format with a type
column indicating input or
output, and a value
column for the corresponding values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), total_input = c(1.0, 2.0, 3.0, 4.0), total_output = c(4.0, 3.0, 2.0, 1.0) ) pivot_longer_data(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC")), total_input = c(1.0, 2.0, 3.0, 4.0), total_output = c(4.0, 3.0, 2.0, 1.0) ) pivot_longer_data(power_data)
Selects a plot function based on the specified type and plots the dataset.
plot(plot_type, power_data)
plot(plot_type, power_data)
plot_type |
Character, the plot type from the dropdown menu. |
power_data |
data frame with |
A ggplot object created by the appropriate plotting function.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot("by month", power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot("by month", power_data)
Generates a bar plot showing hourly input and output sums.
plot_aggregated_by_hour(power_data)
plot_aggregated_by_hour(power_data)
power_data |
data frame with |
A ggplot object showing hourly aggregated values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_hour(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_hour(power_data)
Generates a bar plot showing monthly input and output sums.
plot_aggregated_by_month(power_data)
plot_aggregated_by_month(power_data)
power_data |
data frame with |
A ggplot object showing monthly aggregated values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_month(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_month(power_data)
Generates a bar plot showing yearly input and output sums.
plot_aggregated_by_year(power_data)
plot_aggregated_by_year(power_data)
power_data |
data frame with |
A ggplot object showing yearly aggregated values.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_year(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_aggregated_by_year(power_data)
Generates a bar plot showing hourly input and output sums by month.
plot_by_hour_and_month(power_data)
plot_by_hour_and_month(power_data)
power_data |
data frame with |
A ggplot object showing hourly values by month in facets.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_by_hour_and_month(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_by_hour_and_month(power_data)
Creates a heatmap to show hourly input and output data across months.
plot_heatmap(power_data)
plot_heatmap(power_data)
power_data |
data frame with |
A ggplot object with a heatmap representing input/output.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_heatmap(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_heatmap(power_data)
Creates a line chart to show input/output data by hour for each month.
plot_line_chart(power_data)
plot_line_chart(power_data)
power_data |
data frame with |
A ggplot object with a line chart.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_line_chart(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_line_chart(power_data)
A data frame mapping dropdown box items to corresponding plot functions.
plot_map
plot_map
A data frame with dropdown items as row names and plot function names as column values.
Creates a ridgeline plot to show distribution of input/output data by month.
plot_ridgeline(power_data)
plot_ridgeline(power_data)
power_data |
data frame with |
A ggplot object with a ridgeline plot.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 01:00:00", tz = "UTC"), as.POSIXct("2000-02-02 01:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_ridgeline(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 01:00:00", tz = "UTC"), as.POSIXct("2000-02-02 01:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_ridgeline(power_data)
Creates a stacked area chart to visualize input/output data by month.
plot_stacked_area(power_data)
plot_stacked_area(power_data)
power_data |
data frame with |
A ggplot object with a stacked area chart.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_stacked_area(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-02-01 02:00:00", tz = "UTC"), as.POSIXct("2000-02-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_stacked_area(power_data)
Creates a Bar Chart and also displays mean and percentile values.
plot_top_days(power_data)
plot_top_days(power_data)
power_data |
data frame with |
A ggplot object with a line chart.
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_top_days(power_data)
# Example using a small sample data frame power_data <- data.frame( timestamp = c( as.POSIXct("2000-01-01 01:00:00", tz = "UTC"), as.POSIXct("2000-01-02 01:00:00", tz = "UTC"), as.POSIXct("2000-01-01 02:00:00", tz = "UTC"), as.POSIXct("2000-01-02 02:00:00", tz = "UTC") ), INPUT = c(1.0, 2.0, 3.0, 4.0), OUTPUT = c(4.0, 3.0, 2.0, 1.0) ) plot_top_days(power_data)
Reads power data from .CSV
files in the specified directory,
selecting specific columns and using a custom locale for decimal
and grouping marks.
read_power_data(data_path)
read_power_data(data_path)
data_path |
Character string specifying the directory containing
|
A data frame containing timestamp, input, and output columns from the files.
read_power_data("data/")
read_power_data("data/")