[R] sample nth day data in each month

Carles Fan eexchange at gmail.com
Thu Nov 15 18:54:17 CET 2007


Dear all

i have a time series containing trading dates and historical stock prices:
Date             Price
10-Jan-2007  100
11-Jan-2007  101
13-Jan-2007  99
......
......
......
10-Nov-2007  200

i want to sample every 21st data of each month:
21-Jan-2007 101
21-Feb-2007 111
21-Mar-2007 131
......
......
......
21-Oct-2007 140

1) how can i do that?
2) if some of the dates are non-trading day, how can i tell "R" to use
"modified following" or "following" data?

thanks
carles



More information about the R-help mailing list