I would like to extract some holidays using library(timeDate)
. I have used the following syntax first:
EasterSunday<- as.Date(EasterSunday(2015:2018))
EasterSunday
# [1] "2015-04-05" "2016-03-27" "2017-04-16" "2018-04-01"
Then I wanted to add the corresponding holiday that date sequence:
EasterSunday<- cbind.data.frame(hd=rep('EasterSunday',length(as.Date(EasterSunday(2015:2018)))),date=as.Date(EasterSunday(2015:2018)))
EasterSunday
#hd #date
#1 EasterSunday 2015-04-05
#2 EasterSunday 2016-03-27
#3 EasterSunday 2017-04-16
#4 EasterSunday 2018-04-01
Then I wanted to loop over all holidays in that package:
holidays=c("GoodFriday","EasterSunday","EasterMonday")
# Here I could not find the appropriate function
do.call(cbind, lapply(holidays, function(x) EasterSunday((2015:2018))))
#[,1] [,2] [,3]
#[1,] ? ? ?