-
Notifications
You must be signed in to change notification settings - Fork 25
/
aggregate.weeks.to.months.Rd
executable file
·69 lines (51 loc) · 2.04 KB
/
aggregate.weeks.to.months.Rd
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
63
64
65
66
67
68
69
% Copyright 2011 Google Inc. All Rights Reserved.
% Author: [email protected] (Steve Scott)
\name{aggregate.weeks.to.months}
\alias{AggregateWeeksToMonths}
\title{Aggregate a weekly time series to monthly}
\Rdversion{1.0}
\description{Aggregate measurements from a weekly time series into
a monthly time series. }
\usage{
AggregateWeeksToMonths(weekly.series,
membership.fraction = NULL,
trim.left = TRUE,
trim.right = NULL)
}
\arguments{
\item{weekly.series}{A numeric vector or matrix of class
\code{\link[zoo]{zoo}} giving the weekly time series to be aggregated.
The index must be convertible to class \code{\link{Date}}.}
\item{membership.fraction}{A optional numeric vector corresponding to
\code{weekly.series}, giving the fraction of each week's observation
attributable to the month containing the week's first day. If
missing, then weeks will be split across months in proportion to the
number of days in each month.}
\item{trim.left}{Logical indicating whether the first observation in
the monthly aggregate should be removed.}
\item{trim.right}{Logical indicating whether the final observation in
the monthly aggregate should be removed.}
}
\value{ A zoo-matrix (if \code{weekly.series} is a matrix) or vector
(otherwise) containing the aggregated values of \code{weekly.series}.
}
\author{
Steven L. Scott \email{[email protected]}
}
\seealso{
\code{\link{AggregateTimeSeries}}
}
\examples{
week.ending <- as.Date(c("2011-11-05",
"2011-11-12",
"2011-11-19",
"2011-11-26",
"2011-12-03",
"2011-12-10",
"2011-12-17",
"2011-12-24",
"2011-12-31"))
weekly.values <- zoo(rnorm(length(week.ending)), week.ending)
monthly.values <- AggregateWeeksToMonths(weekly.values)
}
\keyword{chron}