## c -
xmpBasics("Start: Create Character Vectors > ")
dts = c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")
tms = c( "23:12:55", "10:34:02", "08:30:00", "11:18:23")
dts; tms
## "+/-" -
xmpBasics("Start: Add One Day to a Given timeDate Object > ")
GMT = timeDate(dts, FinCenter = "GMT")
ZUR = timeDate(dts, FinCenter = "Europe/Zurich")
GMT + 24*3600
ZUR[2] - ZUR[1]
## "[" -
xmpBasics("Next: Subsets from and Lops for timeDate Objects > ")
GMT[GMT < GMT[2]]
ZUR[ZUR < ZUR[3]] == ZUR[1:3]
## diff -
xmpBasics("Next: Suitably Lagged and Iterated Differences > ")
diff(GMT)
diff(GMT, lag = 2)
diff(GMT, lag = 1, diff = 2)
difftimeDate(GMT[1:2], GMT[-(1:2)])
## c | rep -
xmpBasics("Next: Concatenate and Replicate timeDate Objects > ")
c(GMT[1:2], ZUR[1:2])
c(ZUR[1:2], GMT[1:2])
rep(ZUR[2], times = 3)
rep(ZUR[2:3], times = 2)
## round | truncate -
xmpBasics("Next: Round and Truncate timeDate Objects > ")
modify(GMT, "round", "days")
modify(ZUR, "round", "days")
modify(GMT, "trunc", "days")
modify(ZUR, "trunc", "days")
## start | end | sort -
xmpBasics("Next: Extract First/Last, Sort timeDate Objects > ")
c(start(ZUR), end(ZUR))
modify(ZUR, "sort")
## as -
xmpBasics("Next: Convert timeDate Objects to Other Objects > ")
as.character(ZUR)
as.data.frame(ZUR)
as.POSIXct(ZUR)
## julian -
xmpBasics("Next: Julian Time in Days Since 1970-01-01 > ")
julian(ZUR)
as.integer(julian(ZUR))
julian(ZUR, "days")
as.integer(julian(ZUR, "days"))
## atoms -
xmpBasics("Next: Atoms from a timeDate Object > ")
atoms(ZUR)
atoms(ZUR)[,3]
atoms(ZUR)[, "d"]
Run the code above in your browser using DataLab