Split a timeseries table with a selected frequency

splitTimeSeries(
  rawFileDatatable,
  outputPath = FALSE,
  splitFreq,
  namePattern,
  decC = ".",
  skipRow = c(1, 2),
  timestampColumn = "TIMESTAMP",
  timestampFormat = "%Y-%m-%d %H:%M:%S",
  timestampTZ = "Africa/Algiers",
  datePattern = "%Y_%m_%d_%H%M",
  ...,
  extensionFile = ".dat"
)

Arguments

rawFileDatatable

datatable or path of data or data.frame of the rawfile. If rawFileDatatable is a path, run readRawFileBM function)

outputPath

string of output path to write file (eg. /home/marcel). If False, return data.table

splitFreq

string of split frequency ("day","month" or "year")

namePattern

string of file pattern to write file

decC

Decimal (",", ".")

skipRow

Number of row to skip (e.g header and unit c(1,2))

timestampColumn

Name of timestamp column

timestampFormat

Timestamp format (eg. "%d/%m/%Y %H:%M")

timestampTZ

Timestamp timezone (eg. "Africa/Algiers")

datePattern

string of date pattern to write file (defaut %Y_%m_%d_%H%M)

...

Allows to take arguments that are not predefined in data.table::fread()

extensionFile

string of extension file (eg. ".csv", ".dat"...)

Value

file or data.table timeseries with specific frequency

Examples

library(aigoual) decC <- "." skipRow <- c(1,2) timestampColumn <- "TIMESTAMP" timestampFormat <- "%Y-%m-%d %H:%M:%S" timestampTZ <- "Africa/Algiers" 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") #1. Read data rawFileDatatable <- readRawFileBM(fileInput=TRUE, rawFilePath,decC, skipRow,timestampColumn, timestampFormat,timestampTZ) splitFreq <- "day" # on split pour avoir un fichier par jour namePattern <- "lqu_bm-cent_L03-atm_F01-30s" outputPath <- tempdir() datePattern <- "%Y_%m_%d_%H%M" extensionFile <- ".dat" splitTimeSeries(rawFileDatatable,outputPath,splitFreq,namePattern)