Description Usage Arguments Details Value Author(s) References See Also Examples
These functions support classes timepoint, timeline, mTime, mDate, and mDateTime (and related functions). They are mostly S3 methods for base R generics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## S3 method for class 'timeline'
c(..., recursive = FALSE)
## S3 method for class 'timeline'
x[..., drop = TRUE]
## S3 replacement method for class 'timepoint'
x[...] <- value
## S3 method for class 'timeline'
x[[..., drop = TRUE]]
## S3 method for class 'timepoint'
as.character(x, ...)
as.chartime(x, ...)
## S3 method for class 'numeric'
as.chartime(x, format, mark=TRUE,...)
## S3 method for class 'chartime'
as.numeric(x, format,...)
## S3 method for class 'timepoint'
print(x, ...)
## S3 method for class 'timeline'
rep(x, ...)
## S3 method for class 'timeline'
seq(from, to, by, length.out, along.with, ...)
|
... |
arguments to |
recursive |
same meaning as for |
x |
object of class timepoint |
drop |
same meaning as for ‘[’ and ‘[[’ |
value |
value to be assigned, as for ‘[<-’ |
format |
input or output format describing character time (see |
mark |
boolean: mark times with dangling seconds using ‘+’ |
from |
as for |
to |
as for |
by |
as for |
length.out |
as for |
along.with |
as for |
Normally you shouldn't need to worry about these functions. c and the ‘[’
variants exist just so that class information is not lost on invocation of the
generic. as.character.timepoint and print.timepoint just call format.
chartime variants are used internally by other functions. seq.timeline
requires from. If an interval cannot be calculated from supplied arguments,
by is set to 1 hour for mTime or 1 day for mDate or mDateTime.
print |
an invisible object with same class as |
as.chartime |
generic: does not return |
as.chartime.numeric |
character (time) |
as.numeric.chartime |
numeric (seconds) |
as.character.timepoint |
character (time) |
others |
object with same class as |
Tim Bergsma
http://metrumrg.googlecode.com
timepoint
seq.default
strftime
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #as.data.frame
data.frame(
dt=as.mDateTime(seq(from=0,by=86500,length.out=3)),
d=as.mDate(seq(from=0,by=86400,length.out=3)),
t=as.mTime(c(60,120,180))
)
# dt d t
# 1 1970-01-01 00:00 1970-01-01 00:01
# 2 1970-01-02 00:01+ 1970-01-02 00:02
# 3 1970-01-03 00:03+ 1970-01-03 00:03
#combine
c(as.mTime(0),as.mTime(60))
# 00:00 00:01
c(as.mDate(0),as.mDate(86400))
# 1970-01-01 1970-01-02
c(as.mDateTime(0),as.mDateTime(86500))
# 1970-01-01 00:00 1970-01-02 00:01+
#subset
as.mTime(c('08:00','09:00'))[2]
# 09:00
as.mDate(c('2008-01-01','2008-01-04'))[2]
# 2008-01-04
as.mDateTime(c('2008-01-01 12:00','2008-01-04 12:30'))[2]
# 2008-01-04 12:30
#element selection
as.mTime(c('08:00','09:00'))[[2]]
# 09:00
as.mDate(c('2008-01-01','2008-01-04'))[[2]]
# 2008-01-04
as.mDateTime(c('2008-01-01 12:00','2008-01-04 12:30'))[[2]]
# 2008-01-04 12:30
#assignment
a <- as.mTime(seq(60,300, by=60))
a#00:01 00:02 00:03 00:04 00:05
a[5] <- 60
a#00:01 00:02 00:03 00:04 00:01
a[3] <- NA
a#00:01 00:02 <NA> 00:04 00:01
#identity
as.mTime(as.mTime(0))
# 00:00
as.mDate(as.mDate(0))
# 1970-01-01
as.mDateTime(as.mDateTime(0))
# 1970-01-01 00:00
#repetition
rep(as.mTime(86340),2)
# 23:59 23:59
#sequence
seq(from=as.mTime('00:00'),length.out=3)
seq(from=as.mTime('00:00'),by=as.mTime('00:05'),length.out=3)
seq(from=as.mTime('00:00'),by=as.mTime('00:05'),along.with=integer(3))
seq(from=as.mTime('00:00'),to=as.mTime('06:00'))
seq(from=as.mTime('00:00'),to=as.mTime('06:00'),by=as.mTime('02:00'))
seq(from=as.mTime('00:00'),to=as.mTime('06:00'),length.out=4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.