r -- finding difference between business days

Posted by acesnap on Stack Overflow See other posts from Stack Overflow or by acesnap
Published on 2010-12-30T00:52:00Z Indexed on 2010/12/30 14:53 UTC
Read the original article Hit count: 135

Filed under:

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.

© Stack Overflow or respective owner

Related posts about r