Version: | 2.0.0 |
Date: | 2016-03-16 |
Title: | Remove Weekends and Holidays from ggplot2 Axes |
Depends: | R (≥ 3.2.0) |
Imports: | ggplot2 (≥ 2.1.0), scales (≥ 0.3.0) |
URL: | http://github.com/dvmlls/bdscale |
Description: | Provides a continuous date scale, omitting weekends and holidays. |
License: | GPL-2 |
Suggests: | knitr (≥ 1.12.3), testthat (≥ 0.11.0), rmarkdown (≥ 0.9.5) |
VignetteBuilder: | knitr |
LazyData: | true |
RoxygenNote: | 5.0.1 |
NeedsCompilation: | no |
Packaged: | 2016-03-16 18:37:26 UTC; dmills |
Author: | Dave Mills [aut, cre] |
Maintainer: | Dave Mills <dave.a.mills@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2016-03-17 13:27:37 |
Transform Date
s into your business-date scale.
Description
Transform Date
s into your business-date scale.
Usage
bd2t(dates, business.dates)
Arguments
dates |
a |
business.dates |
a vector of |
Value
returns an integer vector where each element is the number of business days t
after the first date in your business.dates
vector
Examples
monday <- as.Date('2014-10-13')
weekdays <- monday + 0:4
bd2t(monday + c(1, 3), weekdays)
Date breaks corresponding to the first trading day of standard periods
Description
The periods are:
years
quarters
months
weeks
days
Usage
bd_breaks(business.dates, n.max = 5)
Arguments
business.dates |
a vector of |
n.max |
the maximum number of breaks to return |
Value
returns a function function: max => [date range] => breaks
that generates the breaks
for the interval with the largest number of breaks less than n.max
Trading dates for the New York Stock Exchange extracted from the close prices of the S&P 500.
Description
Trading dates for the New York Stock Exchange extracted from the close prices of the S&P 500.
Usage
nyse
Format
A vector of 16657 Date
objects, starting on 1950-01-03 and ending on 2016-03-15
Source
https://finance.yahoo.com/q/hp?s=SPY+Historical+Prices
Weekend- and holiday-ignoring position scale for a ggplot.
Description
Weekend- and holiday-ignoring position scale for a ggplot.
Usage
scale_x_bd(..., business.dates, max.major.breaks = 5,
max.minor.breaks = max.major.breaks * 5,
breaks = bd_breaks(business.dates))
Arguments
... |
other arguments passed to |
business.dates |
a vector of |
max.major.breaks |
maximum major breaks |
max.minor.breaks |
maximum minor breaks |
breaks |
a function |
Examples
## Not run:
ggplot(ts, aes(x=date, y=price)) +
scale_x_bd(business.dates=yahoo('SPY'), max.major.breaks=10, labels=date_format("%b '%y"))
## End(Not run)
Get past trading days using close prices of supplied ticker
Description
Get past trading days using close prices of supplied ticker
Usage
yahoo(ticker = "^GSPC")
Arguments
ticker |
The ticker you want to use, defaults to S&P 500: |
Value
returns a vector of Date
s