<p dir="ltr">No. The output of the actual endpoints function is a set of numbered indices specifying that particular day. E.g. if you look at JUST the output of endpoints, before plugging it into your dataset, you'd see something like 0, 10, 31, etc.</p>
<p dir="ltr">To get the second to last day, you just subtract 1 from that output and set negatives to zero.</p>
<div class="gmail_quote">On Oct 28, 2015 12:40 PM, "Am Gut" <<a href="mailto:agquantr@gmail.com">agquantr@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ilya,<div><br></div><div>Thanks for such a fast reply. The output is the last day of each month in my dataset - so sometimes not necessarily the last day of each month - but the last day of the month within my dataset (which is just the business days):</div><div><br></div><div><img src="cid:ii_150af887c322f4d4" alt="Inline image 1" width="323" height="129"><br></div><div><br></div><div>Please let me know if you have any suggestions on how I can progress along with this issue and thanks in advance.</div><div><br></div><div>Kind Regards,</div><div><br></div><div>AG</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 1:36 PM, Ilya Kipnis <span dir="ltr"><<a href="mailto:ilya.kipnis@gmail.com" target="_blank">ilya.kipnis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Do you know what the output of the endpoints function is? It's trivial from there.</p>
<div class="gmail_quote"><div><div>On Oct 28, 2015 12:35 PM, "Am Gut" <<a href="mailto:agquantr@gmail.com" target="_blank">agquantr@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Good Morning Everyone,<div><br></div><div>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:</div><div><br></div><div><div>##identify second to last business day of every month</div><div>month_end = lookback_returns_nona[endpoints(lookback_returns_nona, on="months"),]</div></div><div><br></div><div>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?</div><div><br></div><div>My dataset simply contains a date index, and a few variables with daily returns:</div><div><br></div><div><br></div><div><img src="cid:ii_150af830821bd87c" alt="Inline image 1" width="323" height="87"><br></div><div><br></div><div>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.</div><div><br></div><div>Kind Regards,</div><div><br></div><div>AG</div></div>
<br></div></div>_______________________________________________<br>
<a href="mailto:R-SIG-Finance@r-project.org" target="_blank">R-SIG-Finance@r-project.org</a> mailing list<br>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-finance" rel="noreferrer" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-finance</a><br>
-- Subscriber-posting only. If you want to post, subscribe first.<br>
-- Also note that this is not the r-help list where general R questions should go.<br></blockquote></div>
</blockquote></div><br></div>
</blockquote></div>