Learn R Programming

timetools (version 1.5.2)

as.SubtimeDataFrame: Convert an object to a SubtimeDataFrame

Description

Convert an object to a SubtimeDataFrame

Usage

as.SubtimeDataFrame(x, unit, of, ...)

## S3 method for class 'TimeInstantDataFrame': as.SubtimeDataFrame(x, unit, of, FUN=NULL, ...)

## S3 method for class 'TimeIntervalDataFrame': as.SubtimeDataFrame(x, unit, of, FUN=NULL, cursor=NULL, ...)

Arguments

x
object to convert to a TimeInstantDataFrame
...
more args to or from other methods or FUN
FUN
function to use for the agregation (if wanted, see details)
unit
indicates the subtime part to extract ('year', 'month', 'day', 'hour', 'minute', 'second')
of
used to specify the main period from wich the is to extract ('year', 'month', day', 'hour', 'minute'). Not used for unit in c('year', 'month').
cursor
for TimeIntervalDataFrame, if not NULL, the object is first coerced to a TimeInstantDataFrame using the as.TimeInstantDataFrame method.

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).