Special Monthly Series
Functions and methods dealing with special monthly 'timeSeries' objects.
1 2 3 4 5
a 'timeSeries' object.
a character string specifying the rollling period composed by
the length of the period and its unit. As examples:
a character string specifying the rolling shift composed by
the length of the shift and its unit. As examples:
the function for the statistic to be applied. For example
in the case of aggregation use
arguments passed to the function
countMonthlyRecords computes a 'timeSeries'
that holds the number of monthly counts of the records.
rollMonthlyWindows computes start and end
dates for rolling time windows.
rollMonthlySeries computes a static over
rolling periods defined by the function
countMonthlyRecords returns a 'timeSeries'
rollMonthlyWindows returns a list with two
named 'tomeDate' entries:
to. An attribute
"control" is added which keeps the
end dates of the series.
rollMonthlySeries computes the statistics
defined by the function
FUN over a rolling window
internally computed by the function
Note, the periods may be overlapping, may be dense, or even
may have gaps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## Load Microsoft Daily Data Set: x <- MSFT ## Count Monthly Records - counts <- countMonthlyRecords(x) counts ## Quaterly Non-Overlapping Time Periods - windows <- rollMonthlyWindows(counts[-1, ], period = "3m", by = "3m") windows ## Nicely Reprint Results as a data.frame - data.frame(cbind(FROM=format(windows$from), TO=format(windows$to))) ## Compute the average number of monthly trading days per quarter - rollMonthlySeries(counts[-1, ], period = "3m", by = "3m", FUN=mean)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.