Closest weekly endpoint to the fifteenth of the month

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Closest weekly endpoint to the fifteenth of the month

Ilya Kipnis
Hi there. I have a question about custom endpoints. Currently, in R, you
can set endpoints to weekly, monthly, quarterly, etc...

However, I was wondering if there was a way to do this:

Assuming you have weekly endpoints, is there a way to select, in each
month, the day closest to the fifteenth--AKA middle of the month?

Right now, my idea is to loop through each individual month, subtract 15
from each date, end pick the one closest to zero, and index it. I was
wondering if there's a more elegant method of doing this.

Thanks.

-Ilya

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.