From d6b230cd1b415a112009227bc9e0ff50316c42f7 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 15 Jul 2016 15:05:22 +0200 Subject: Fix calculation of t_firstjan There is an inconsistency in (some?) output files, so the first datetime needs to be fixed before reading it into a data frame --- pkg/R/TOXSWA_cwa.R | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/R/TOXSWA_cwa.R') diff --git a/pkg/R/TOXSWA_cwa.R b/pkg/R/TOXSWA_cwa.R index 5f32860..fd056b2 100644 --- a/pkg/R/TOXSWA_cwa.R +++ b/pkg/R/TOXSWA_cwa.R @@ -232,6 +232,12 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", cwa_all_segments <- read_fwf(paste(cwa_lines, collapse = "\n"), fwf_empty(paste(tail(cwa_lines), collapse = "\n"))) + # Append time "-00h00" to datetime in first row, as this is not (always?) present + # in the line ConLiqWatLayCur + if (nchar(cwa_all_segments[1, "X2"]) == 11) { + cwa_all_segments[1, "X2"] = paste0(cwa_all_segments[1, "X2"], "-00h00") + } + available_segments = 1:(ncol(cwa_all_segments) - 3) if (segment == "last") segment = max(available_segments) if (!segment %in% available_segments) stop("Invalid segment specified") -- cgit v1.2.1