Skip to content
Prev 13591 / 15274 Next

Subsetting Second to Last Day of the Month

Illya,

Thanks for the help as I was able to get the intended result with the
following code (still one question remains):

##identify second to last business day of every month
month_end_rank = endpoints(matrix_rank, on ="months")
month_end_rank_minus = month_end_rank - 1
month_end_rank_minus = rbind(month_end_rank_minus)
for (i in 1:nrow(month_end_rank_minus))
{
    if (month_end_rank_minus[i]< 0)
    {
        month_end_rank_minus = month_end_rank_minus[-i]
    }
}
matrix_rank_minus = matrix_rank[month_end_rank_minus,]


However, if I wanted the second to last business day of each month and all
days of the year were loaded in the dataset, how would I communicate with R
that I want the second to last *business* day now that business days and
non-business days are loaded in the dataset. I would be going back a
different number of days different times. I have been looking through the
packages and still was unable to find an application. If you know of how, I
would also appreciate that insight.

Thanks for all of your help today. I am up and running for now.

AG
On Wed, Oct 28, 2015 at 1:43 PM, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151028/4947770d/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/4947770d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7735 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151028/4947770d/attachment-0001.png>