Description Usage Arguments Details Value Author(s) References See Also Examples
Generate indicator variables for holidays and other special dates
1 2 |
date |
date formatted vector. See |
holidays |
vector of strings for the holidays names |
dates |
vector of strings for the holidays dates formatted as |
selection |
a logical indicating whether |
country |
a string indicating the country rules. Default is |
This function scans date
looking for matches to each element of dates
and if it finds any 1 is assigned to the variable 0 otherwise. The column is named according to holidays
. If both holidays
and date
are omitted and country
is set to a valid rule, country-specific holidays are included in the matrix. If both .holidays
and .dates
vectors are set in the global environment they are used instead of country rules (that are overridden) to flag the fixed holidays. Moving holidays based on Easter are computed by the function moving.holidays
.
Automatically created holidays are Christmas, New year, Carnaval, Passion, Easter and Corpus Christi. If both holidays
and date
are supplied by the function caller then the resulting matrix will contain only those holidays and these automatically created holidays will be omitted. Thus, one can use this function for both automatically create holidays and/or some special days indicators. The vector dates
can contain dates formatted as both "dd/mm"
and "dd/mm/yyyy"
. The first format will flag all occurrences of that day and month in date
and the second, obviously, will flag the only one occurrence.
Other country rules can be added to this function in the future. If you have a list of holidays for you country, send us a note.
A matrix of indicator variables for the holidays with as many rows as date
.
Washington Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br
Schwartz, J., Spix, C., Touloumi, G. et al. (1996) Methodological issues in studies of air pollution and daily counts of deaths or hospital admissions. J Epidemiol. Community Health 50 (suppl 1), S12–S18.
1 2 3 4 5 6 7 8 9 10 11 12 | data(admrio)
names(admrio)
setup(admrio,"date")
# some mexican holidays plus moving holidays
holidays <- c("constitucion","cincomayo","independencia")
dates <- c("05/02","05/05","16/09")
doe <- .aresEnv$ares.active.dataset$doe
mx.holidays <- gen_holidays(doe)
# special days
strikes <- gen_holidays(doe,holidays=c("transportation","hospitals"),
dates=c("02/04/2001","21/05/2001"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.