#' @title show_special_day
#' @description Shows if a date is the first/last trading day of the week/month.
#' @param date_as_char character, a date (inputted as a string) in YYYY-MM-DD format (%Y-%m-%d), Defaults to today's date
#' @return A string indicating any of the three: EOM (end of month), SOM (start of month), EOW (end of week).
#' @export
show_special_day <- function(date_as_char)
{
if (missing(date_as_char)) date_as_char <- Sys.Date()
else date_as_char <- as.Date(date_as_char)
if (!file.exists('data/dates.rds')) make_dates()
dates <- readRDS('data/dates.rds')
out <- sapply(dates, function(x) date_as_char %in% x)
out[1:3] %>% .[.] %>% names
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.