r -- finding difference between business days
- by acesnap
I have several years of data (only for business days (no weekends or holidays)) in an [r] data frame and would like to find the difference between the data on the 2nd and 5th business day of each month. So the solution needs to go thru the list, determine the 2nd and 5th business day, get the data for the corresponding dates and then find the difference.
the data looks like:
1/19/1990 1.22
1/20/1990 1.25
1/23/1990 1.26 (Gap in date is weekend)
...
2/1/1990 1.34
2/2/1990 1.36
2/5/1990 1.22 (Gap in date is weekend)
I have tried using dateTime() but it doesn't handicap for weekends and holidays. Any suggestions would be appreciated, thanks.