The R Project SVN R

Rev

Rev 61168 | Rev 68963 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61168 Rev 61433
Line 29... Line 29...
29
}
29
}
30
\arguments{
30
\arguments{
31
  \item{x}{an R object.}
31
  \item{x}{an R object.}
32
  \item{by}{a list of grouping elements, each as long as the variables
32
  \item{by}{a list of grouping elements, each as long as the variables
33
    in the data frame \code{x}.  The elements are coerced to factors
33
    in the data frame \code{x}.  The elements are coerced to factors
34
    before use.} 
34
    before use.}
35
  \item{FUN}{a function to compute the summary statistics which can be
35
  \item{FUN}{a function to compute the summary statistics which can be
36
    applied to all data subsets.}
36
    applied to all data subsets.}
37
  \item{simplify}{a logical indicating whether results should be
37
  \item{simplify}{a logical indicating whether results should be
38
    simplified to a vector or matrix if possible.}
38
    simplified to a vector or matrix if possible.}
39
  \item{formula}{a \link{formula}, such as \code{y ~ x} or
39
  \item{formula}{a \link{formula}, such as \code{y ~ x} or
Line 57... Line 57...
57
  \item{\dots}{further arguments passed to or used by methods.}
57
  \item{\dots}{further arguments passed to or used by methods.}
58
}
58
}
59
\details{
59
\details{
60
  \code{aggregate} is a generic function with methods for data frames
60
  \code{aggregate} is a generic function with methods for data frames
61
  and time series.
61
  and time series.
62
  
62
 
63
  The default method, \code{aggregate.default}, uses the time series
63
  The default method, \code{aggregate.default}, uses the time series
64
  method if \code{x} is a time series, and otherwise coerces \code{x}
64
  method if \code{x} is a time series, and otherwise coerces \code{x}
65
  to a data frame and calls the data frame method.
65
  to a data frame and calls the data frame method.
66
 
66
 
67
  \code{aggregate.data.frame} is the data frame method.  If \code{x} is
67
  \code{aggregate.data.frame} is the data frame method.  If \code{x} is
Line 79... Line 79...
79
  common length of one or greater than one, respectively; otherwise,
79
  common length of one or greater than one, respectively; otherwise,
80
  lists of summary results according to subsets are obtained.  Rows with
80
  lists of summary results according to subsets are obtained.  Rows with
81
  missing values in any of the \code{by} variables will be omitted from
81
  missing values in any of the \code{by} variables will be omitted from
82
  the result.  (Note that versions of \R prior to 2.11.0 required
82
  the result.  (Note that versions of \R prior to 2.11.0 required
83
  \code{FUN} to be a scalar function.)
83
  \code{FUN} to be a scalar function.)
84
  
84
 
85
  \code{aggregate.formula} is a standard formula interface to
85
  \code{aggregate.formula} is a standard formula interface to
86
  \code{aggregate.data.frame}.
86
  \code{aggregate.data.frame}.
87
  
87
 
88
  \code{aggregate.ts} is the time series method, and requires \code{FUN}
88
  \code{aggregate.ts} is the time series method, and requires \code{FUN}
89
  to be a scalar function.  If \code{x} is not a time series, it is
89
  to be a scalar function.  If \code{x} is not a time series, it is
90
  coerced to one.  Then, the variables in \code{x} are split into
90
  coerced to one.  Then, the variables in \code{x} are split into
91
  appropriate blocks of length \code{frequency(x) / nfrequency}, and
91
  appropriate blocks of length \code{frequency(x) / nfrequency}, and
92
  \code{FUN} is applied to each such block, with further (named)
92
  \code{FUN} is applied to each such block, with further (named)
Line 94... Line 94...
94
  series with frequency \code{nfrequency} holding the aggregated values.
94
  series with frequency \code{nfrequency} holding the aggregated values.
95
  Note that this make most sense for a quarterly or yearly result when
95
  Note that this make most sense for a quarterly or yearly result when
96
  the original series covers a whole number of quarters or years: in
96
  the original series covers a whole number of quarters or years: in
97
  particular aggregating a monthly series to quarters starting in
97
  particular aggregating a monthly series to quarters starting in
98
  February does not give a conventional quarterly series.
98
  February does not give a conventional quarterly series.
99
  
99
 
100
  \code{FUN} is passed to \code{\link{match.fun}}, and hence it can be a
100
  \code{FUN} is passed to \code{\link{match.fun}}, and hence it can be a
101
  function or a symbol or character string naming a function.
101
  function or a symbol or character string naming a function.
102
}
102
}
103
\value{
103
\value{
104
  For the time series method, a time series of class \code{"ts"} or
104
  For the time series method, a time series of class \code{"ts"} or