Learn R Programming

timetools (version 1.5.2)

POSIXst: Create an object of class POSIXst (subtime object) (S4 class)

Description

Create an object of class POSIXst (subtime object) (S4 class)

Usage

POSIXst(x, unit, of = NULL, tz = "UTC", ...)

## S3 method for class 'default': POSIXst(x, unit, of = NULL, tz = "UTC", ...)

## S3 method for class 'integer': POSIXst(x, unit, of = NULL, tz = "UTC", ...) ## S3 method for class 'numeric': POSIXst(x, unit, of = NULL, tz = "UTC", ...)

## S3 method for class 'POSIXct': POSIXst(x, unit, of = NULL, tz = attributes(x)$tzone, ...) ## S3 method for class 'POSIXlt': POSIXst(x, unit, of = NULL, tz = attributes(x)$tzone, ...)

## S3 method for class 'TimeInstantDataFrame': POSIXst(x, unit, of = NULL, tz = timezone(x), ...)

## S3 method for class 'TimeIntervalDataFrame': POSIXst(x, unit, of = NULL, tz = timezone(x), ..., cursor = NULL)

year(x, ...) month(x, ...) day(x, of, ...) hour(x, of, ...) minute(x, of, ...) second(x, of, ...)

Arguments

x
object to convert into POSIXst
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').
tz
if needed, specifies th timezone of POSIXst
...
more arguments to or from other methods
cursor
for TimeIntervalDataFrame, if not NULL, the object is first coerced to a TimeInstantDataFrame using the as.TimeInstantDataFrame method.

Value

  • a factor which depends on the subtime asked for. See Details.

POSIXst('default', unit, of = NULL, tz = "UTC", ...)

If x is missing, an empty factor with the appropriated levels (according to unit and of) is returned.

POSIXst('integer', x, unit, of = NULL, tz = "UTC", ...)

This is the default constructor.

POSIXst('numeric', unit, of = NULL, tz = "UTC", ...)

If x is a numeric, its values must be in the right range (see DateTimeClasses and must be "like" an integer.

POSIXst('POSIXct', unit, of = NULL, tz = attributes(x)$tzone, ...)

with the tz argument, one can specify/change the timezone of the resulting POSIXst

POSIXst('POSIXlt', unit, of = NULL, tz = attributes(x)$tzone, ...)

with the tz argument, one can specify/change the timezone of the resulting POSIXst

POSIXst('TimeInstantDataFrame', unit, of = NULL, tz = timezone(x), ...)

This methode extract subtimes (POSIXst), from TimeInstantDataFrame.

with the tz argument, one can specify/change the timezone of the resulting POSIXst

POSIXst('TimeIntervalDataFrame', unit, of = NULL, tz = timezone(x), ..., cursor = NULL)

Because an time interval can contain several POSIXst of one kind for instance a day contains all 'hours of day'), the result of this function for TimeIntervalDataFrame is a list of POSIXst. Each element of the list contains the POSIXsts asked for corresponding to each row of the TimeIntervalDataFrame object.

year(...), month(...), day(...), hour(...), minute(...) and second(...)

year, month, day, hour, minute and second are methods defined to extract the adequat information from a time object. These functions are wrappers to POSIXst. Each of these methods call POSIXst replacing the unit argument with its own name :

minute(x, of='day') will call

POSIXst(x, unit='minute', of='day')

See Also

timezone, POSIXt.units, POSIXst-class