From: Benjamin Auder Date: Wed, 22 Mar 2017 14:32:12 +0000 (+0100) Subject: Fix time acquisition by adding 'tz' arg X-Git-Url: https://git.auder.net/images/doc/html/current/pieces/css/rpsls.css?a=commitdiff_plain;h=7f90df63d1ac659d450a180b50b994a76d5fc7b9;p=talweg.git Fix time acquisition by adding 'tz' arg --- diff --git a/pkg/R/getData.R b/pkg/R/getData.R index a4e1e17..9ed0217 100644 --- a/pkg/R/getData.R +++ b/pkg/R/getData.R @@ -49,14 +49,16 @@ getData = function(ts_data, exo_data, input_tz="GMT", date_format="%d/%m/%Y %H:% read.csv(ts_data) else ts_data + # Convert to the desired timezone (usually "GMT" or "Europe/Paris") + formatted_dates_POSIXlt = strptime(as.character(ts_df[,1]), date_format, tz=input_tz) + ts_df[,1] = format(as.POSIXct(formatted_dates_POSIXlt, tz=input_tz), tz=working_tz, usetz=TRUE) + exo_df = if (is.character(exo_data)) read.csv(exo_data) else exo_data - # Convert to the desired timezone (usually "GMT" or "Europe/Paris") - formatted_dates_POSIXlt = strptime(as.character(ts_df[,1]), date_format, tz=input_tz) - ts_df[,1] = format(as.POSIXct(formatted_dates_POSIXlt), tz=working_tz, usetz=TRUE) + # Times in exogenous variables file are ignored: no conversions required line = 1 #index in PM10 file (24 lines for 1 cell) nb_lines = nrow(ts_df)