Learn R Programming

timetools (version 1.1-2)

as.SubtimeDataFrame: Convert an object to a SubtimeDataFrame

Description

Convert an object to a SubtimeDataFrame

Usage

as.SubtimeDataFrame(from, ...)

## S3 method for class 'TimeInstantDataFrame': as.SubtimeDataFrame(from, representation, FUN=mean, ..., first.day=0)

## S3 method for class 'TimeIntervalDataFrame': as.SubtimeDataFrame(from, representation, cursor=NULL, FUN=mean, ..., first.day=0)

Arguments

from
object to convert to a TimeInstantDataFrame
...
more args to or from other methods or FUN
FUN
function to use for the agregation (see details)
representation
character string indicating which subtime is to extract ('mday', 'mon', 'wday', 'yday', 'sec', 'min', 'hour').
first.day
used only if representation == 'wday'. Interger indicating the first day of the week. 0 -> sunday (the default), 1 -> monday, 2 -> tuesday, etc.
cursor
indicates where the TimeInstant must be taken. If 0, start of each intervals is taken as instant ; if 1 end of each intervals is taken as instant. Any other value will determine a weigthed instant between start and end (

Value

TimeIntervalDataFrame

If from is a TimeIntervalDataFrame, data is first converted to a TimeInstantDataFrame (see as.TimeInstantDataFrame). Then, this TimeInstantDataFrame is converted to a SubtimeDataFrame (see the appropriated section).