Learn R Programming

antaresRead (version 2.1.0)

changeTimeStep: Change the timestep of an output

Description

This function changes the timestep of a table or an antaresData object and performs the required aggregation or desaggregation.Notice that currently, the function performs the same operation on all the columns of a table (either sum or mean). Check that this is effectively what you want to do. If it is not the case, either select only the columns on which yo uwant to perform the same operation or do not use it at all ! In future versions, this function may have a smarter behavior.

Usage

changeTimeStep(x, newTimeStep, oldTimeStep, fun = "sum",
  opts = simOptions())

Arguments

x

data.table with a column "timeId" or an object of class "antaresDataList"

newTimeStep

Desired time step.The possible values are hourly, daily, weekly, monthly and annual.

oldTimeStep

Current time step of the data. This argument is optional for an object of class antaresData because the time step of the data is stored inside the object

fun

Character vector with one element per column to (des)agregate indicating the function to use ("sum", "mean", "min" or "max") for this column. It can be a single element, in that case the same function is applied to every columns.

opts

list of simulation parameters returned by the function setSimulationPath

Value

Either a data.table or an object of class "antaresDataList" depending on the class of x

Examples

Run this code
# NOT RUN {
setSimulationPath()

areasH <- readAntares(select = "LOAD", synthesis = FALSE, mcYears = 1)
areasD <- readAntares(select = "LOAD", synthesis = FALSE, mcYears = 1, timeStep ="daily")

areasDAgg <- changeTimeStep(areasH, "daily")

all.equal(areasDAgg$LOAD, areasD$LOAD)

# Use different aggregation functions
mydata <- readAntares(select = c("LOAD", "MRG. PRICE"), timeStep = "monthly")
changeTimeStep(mydata, "annual", fun = c("sum", "mean"))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab