gettime {activity}R Documentation

Convert time of day data to numeric

Description

Accepts data of class POSIXct, POSIXlt or character and returns the time of day element as numeric (any date element is ignored).

Usage

gettime(
  x,
  format = "%Y-%m-%d %H:%M:%S",
  scale = c("radian", "hour", "proportion")
)

Arguments

x

A vector of POSIXct, POSIXlt or character format time data to convert.

format

A character string defining the time/date format if x is character format, see strptime for details. Ignored if x is not character.

scale

The scale on which to return times (see Value for options).

Value

A vector of numeric times of day in units defined by the scale argument: radian, on the range [0, 2*pi]; hours, on the range [0, 24]; proportion, on the range [0, 1].

See Also

strptime

Examples

data(BCItime)
rtime <- gettime(BCItime$date, "%d/%m/%Y %H:%M")
htime <- gettime(BCItime$date, "%d/%m/%Y %H:%M", "hour")
ptime <- gettime(BCItime$date, "%d/%m/%Y %H:%M", "proportion")
summary(rtime)
summary(htime)
summary(ptime)

[Package activity version 1.3.1 Index]