From 6a4490514c6e40f342a534b036eb800dd5631efe Mon Sep 17 00:00:00 2001 From: Dorchies David <david.dorchies@irstea.fr> Date: Mon, 15 Mar 2021 14:00:30 +0100 Subject: [PATCH] fix: date time format change on SGL website Fix #2 --- DESCRIPTION | 2 +- R/sgl.R | 2 +- R/thingsboard.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e10541a..4bf3f3c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: SGLdataGrabber Title: Grab available data from EPTB Seine Grands Lacs web site -Version: 0.1.1 +Version: 0.1.2 Authors@R: person(given = "David", family = "Dorchies", diff --git a/R/sgl.R b/R/sgl.R index 39631ce..fb6bbe4 100644 --- a/R/sgl.R +++ b/R/sgl.R @@ -43,7 +43,7 @@ SGL_GrabVariableListAll <- function( #' #' @param URL Complete URL of the data source. #' -#' @return A dataframe containing stata time series with 2 columns: `datetime` (Unix timestamp format) and `value`. +#' @return A dataframe containing stata time series with 2 columns: `datetime` ([character] format "YYYY-MM-DDThh:mm") and [numeric] `value`. #' @export #' #' @import httr diff --git a/R/thingsboard.R b/R/thingsboard.R index 2369ba3..5450c1d 100644 --- a/R/thingsboard.R +++ b/R/thingsboard.R @@ -16,7 +16,7 @@ #' ) #' } thingsboard_UploadTelemetry <- function(URL, dfData) { - dfData$datetime <- paste0(format(dfData$datetime), "000") + dfData$datetime <- paste0(format(as.numeric(as.POSIXct(dfData$datetime))), "000") lData <- split(dfData, dfData$datetime) lapply(X = lData, FUN = thingsboard_UploadTimeStep, URL) } -- GitLab