convert data.table to xts format for use dygraph function

dataToXTS(meltData, variableName, timestampColumn = "TIMESTAMP")

Arguments

meltData

data.frame in vertical format (after reshape::melt(), with a timestamp column)

variableName

String of variable code into meltData (ex. "WTD", or c("WTD","TS_1_1_1"))

timestampColumn

Name of timestampColumn. By default, TIMESTAMP

Value

xts object to used with dygraph with all variable selected ()

Examples

library(aigoual) # Data rawFilePath <- system.file("extdata/bm-cent_L03-atm/0_rawdata/F01-30s/", "lqu_bm-cent_L03-atm_F01-30s_2021_05_17_0000.dat", package = "aigoual") decC <- "." skipRow <- c(1,2) timestampColumn <- "TIMESTAMP" timestampFormat <- "%Y-%m-%d %H:%M:%S" timestampTZ <- "Africa/Algiers" #1. Read data rawFileDatatable <- readRawFileBM(fileInput=TRUE, rawFilePath,decC, skipRow,timestampColumn, timestampFormat,timestampTZ) #2. Melt data meltTimeSerie <- data.table::setDT(reshape::melt(rawFileDatatable,id=c("TIMESTAMP"),na.rm=TRUE)) #3. Run dataToXTS function xtsData <- aigoual::dataToXTS(meltTimeSerie[,list(TIMESTAMP,variable,value)],"Tair_50_Ta_1_1_1")