I have time series data taken from the Korean stock exchange, but I need to create a date sequence without holidays and weekends to match the data
I created a weekends-less date sequence as follows
X <- seq( as.Date("1999/1/04"), as.Date("2018/12/31"),"days")
Dat1 <- X[ ! weekdays(X) %in% c("Saturday", "Sunday")]
str(Dat1)
Date[1:5216], format: "1999-01-04" "1999-01-05" "1999-01-06" "1999-01-07" "1999-01-08" ...
Then by using the RQuantLib package, I created a list of holiday dates
library(RQuantLib)
from <- as.Date("1999-01-04")
to<-as.Date("2018-12-31")
Dat2 <- getHolidayList("SouthKorea/KRX", from, to)
str(Dat2)
Date[1:237], format: "1999-03-01" "1999-04-05" "1999-05-05" "1999-12-31" "2000-03-01" ...
How can I remove the dates of Dat2 object from the date range Dat1?
Dat3 <- Dat1[! Dat1 %in% Dat2]? - ulfelder