F.summarize.index: F.summarize.index

F.summarize.indexR Documentation

F.summarize.index

Description

Summarize a POSIX-formatted vector of dates to one of either day, week, month, or year.

Usage

F.summarize.index(dt, summarize.by)

Arguments

dt

A POSIX-formatted date.

summarize.by

A string time unit into which summary occurs, i.e., one of "day," "week," "month," "year."

Details

The vector fed to function F.summarize.passage must have a day-fished POSIX column, formatted via the ISO 8601 date format (%F) of %Y-%m-%d, with year formatted via four characters.

Function F.summarize.index formats each of day, week, month, and year separately. When summarize.by="day", function F.summarize.index simply places the provided POSIX vector dt into a list. When summarize.by="week", table the.dates, containing Julian weeks and originating from table "Dates" in the underlying Access database, is used to map provided dates to the specialized Julian Week. When summarize.by="month", the provided dates are formatted via "%Y-%m". Finally, when summarize.by="year", provided dates are set to the mean year spanning the range of dates provided. This is necessary because dates could span up to 365 days, which almost always includes two distinct years.

Value

A single-entry list containing a vector of POSIX dates, formatted via the units specified by summarize.by.

Author(s)

WEST Inc.

See Also

F.summarize.passage

Examples

## Not run: 
#   ---- Create a list containing a vector of POSIX dates.
beg <- strptime("2013-12-24",format="%F",tz="America/Los_Angeles")
batchDate <- rep(seq(beg,by=60*60*24,length.out=100),2)

#   ---- Summarize indices by different time frames.
list.day <- F.summarize.index( batchDate, "day" )

#   ---- All indices 2014, even though some dates 2013.
list.year <- F.summarize.index( batchDate, "year" )

  ---- Removed these since they depend on having Julian weeks with which 
  ---- to work.  But these require querying an Access database.  

#   ---- Dec. 31st becomes the 53rd week, by design.
list.week <- F.summarize.index( batchDate, "week" )
list.month <- F.summarize.index( batchDate, "month" )


## End(Not run)

tmcd82070/CAMP_RST documentation built on April 6, 2022, 12:07 a.m.