Learn R Programming

timetools (version 1.1-2)

TimeIntervalDataFrame: Create a TimeIntervalDataFrame from scratch

Description

To see all methods related to this class, see TimeIntervalDataFrame-class

Usage

TimeIntervalDataFrame(start, end = NULL,
    timezone = "UTC", data = NULL, ...)

Arguments

start
POSIXct or character representing a time with a valid format (see POSIXct). It gives the begining of each interval.
end
POSIXct or character representing a time with a valid format (see POSIXct). It gives the end of each interval. If NULL, see Details.
timezone
character representing a valid timezone (see timezone).
data
a data.frame with as much rows as the length of start and end, or with one row less than the length of start if end is NULL. Can be NULL (hence the data.frame has zero colu
...
arguments to or from other methods

Value

Details

If both start and end are given, they must have the same length. They are used to define the intervals of the object. If data is also given, it must have a number of rows identical to the length of start and end.

If only start is given, a continuous (see continuous) TimeIntervalDataFrame is built. The first element of start is the start of the first interval, the second element is the end of the first interval and the start of the second interval. The last element of start is only the end of the last interval. This is why data, if given, must be one row shorter than start.

To access to the class documentation, type in the R console :

class?TimeIntervalDataFrame

See Also

TimeInstantDataFrame, RegularTimeIntervalDataFrame, timetools

Examples

Run this code
TimeIntervalDataFrame (
	c('2010-01-01', '2010-02-01'), c('2010-02-01', '2010-02-02'),
	'UTC', data.frame(ex=1:2) )

TimeIntervalDataFrame (
	c('2010-01-01', '2010-02-01', '2010-02-02'), NULL,
	'UTC', data.frame(ex=1:2) )

Run the code above in your browser using DataLab