F.summarize.index | R Documentation |
Summarize a POSIX-formatted vector of dates to one of either day, week, month, or year.
F.summarize.index(dt, summarize.by)
dt |
A POSIX-formatted date. |
summarize.by |
A string time unit into which summary occurs, i.e., one
of " |
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.
A single-entry list containing a vector of POSIX dates, formatted via
the units specified by summarize.by
.
WEST Inc.
F.summarize.passage
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.