chron: Chronological Objects which can Handle Dates and Times

> library(chron)

バージョン: 2.3.47


関数名 概略
as.chron.yearmon Convert monthly or quarterly data to chron
chron Create a Chronological Object
chron_trans Coordinates and Positions for Chronological Objects
cut.dates Create a Factor from a Chron or Dates Object
dates Generate Dates and Times Components from Input
day.of.week Convert between Julian and Calendar Dates
days Return Various Periods from a Chron or Dates Object
format.chron Format a chron object
hours Return Hours, Minutes, or Seconds from a Times Object
is.holiday Find Weekends and Holidays in a Chron or Dates Object
seq.dates Generate Chron or Dates Sequences
trunc.times Truncate times Objects

dates / times

日付、時間要素の生成

> c("09/01/15", "09/02/15") %>% class()
[1] "character"
> dates(c("09/01/15", "09/02/15")) %>% class()
[1] "dates" "times"
> times(c("20:47:00", "20:47:01")) %>% class()
[1] "times"

seq.dates

連続的な時間オブジェクトを生成する

> seq.dates("01/01/92", "12/31/92", by = "months")
 [1] 01/01/92 02/01/92 03/01/92 04/01/92 05/01/92 06/01/92 07/01/92
 [8] 08/01/92 09/01/92 10/01/92 11/01/92 12/01/92

yearmon

> head(AirPassengers)
[1] 112 118 132 129 121 135
> head(as.chron(AirPassengers))
[1] 01/01/49 02/01/49 03/01/49 04/01/49 05/01/49 06/01/49