From 3eba87d47a7fda011da6ff45d71d308642788e20 Mon Sep 17 00:00:00 2001 From: antux18 Date: Wed, 21 Aug 2024 15:33:49 +0200 Subject: [PATCH] Added an option to set the output path of the plotting script. Changed name and order of the options of the plotting script. --- plot/plot.r | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plot/plot.r b/plot/plot.r index 752ded4..b86fed1 100755 --- a/plot/plot.r +++ b/plot/plot.r @@ -6,11 +6,14 @@ library(tidyverse) # Parsing command line arguments: options = commandArgs(trailingOnly = TRUE) -filename = options[1] -plot_type = options[2] -table_header = options[-1:-2] +plot_type = options[1] +input = options[2] +output = options[3] +table_header = options[-1:-2:-3] -read_csv(filename, col_names = table_header) %>% +pdf(output) + +read_csv(input, col_names = table_header) %>% mutate(timestamp = as_date(as_datetime(timestamp))) %>% # Formatting the date melt(id.vars = "timestamp", variable.name = "category", value.name = "amount") %>% # Formatting the table to plot each category {