[R-SIG-Finance] Subsetting Second to Last Day of the Month

Ilya Kipnis ilya.kipnis at gmail.com
Wed Oct 28 18:36:38 CET 2015


Do you know what the output of the endpoints function is? It's trivial from
there.
On Oct 28, 2015 12:35 PM, "Am Gut" <agquantr at gmail.com> wrote:

> Good Morning Everyone,
>
> I have essentially two questions. I am trying to subset a an existing
> dataset based on the last two business days of each month in the dataset. I
> am able to subset based on the last business day of each month (or the last
> day as I am only using business days in my dataset) via the following code:
>
> ##identify second to last business day of every month
> month_end = lookback_returns_nona[endpoints(lookback_returns_nona,
> on="months"),]
>
> However, I do not have to make this the second to last day instead. In
> addition, can someone help me understand how I could do the last business
> day of each month and the second to last business day of each month?
>
> My dataset simply contains a date index, and a few variables with daily
> returns:
>
>
> [image: Inline image 1]
>
> As a side note, I am new to the forum so please feel free to let me know
> if I am not observing proper posing rules. Thanks in advance as any help
> would be extremely useful.
>
> Kind Regards,
>
> AG
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151028/6004cbcb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 5672 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151028/6004cbcb/attachment.png>


More information about the R-SIG-Finance mailing list