I suspect the answer to your question (is there a function...) is almost 
certainly yes, but your question is too vague to be sure.

1) Data frames and matrices are different in important ways... it is highly 
unlikely that matrices would be appropriate for date data. 

2) Do you mean "select records with earliest date in each month" or "select 
records whose day of month is 1"? If you need to work with time of day along 
with date then the solution will be different than if you are working with date 
only.

3) Have you converted your dates to Date or POSIXct or chron already? Which? 

4) There are a lot of useful functions in base R [1][2], as well as contributed 
packages such as chron and lubridate.

A reproducible example [3] is the standard way to communicate what problem you 
actually have.  In particular, including the output of dput for a 
representative sample of data is a key element of that example. 

[1] ?DateTimeClasses
[2] R News 4/1 p29
[3] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
-- 
Sent from my phone. Please excuse my brevity.

On July 14, 2016 5:44:52 AM PDT, "Mehta, Gaurang" 
<gaurang.me...@royallondon.com> wrote:
>Hi Team,
>I am struggling to select the first date and last date of the month
>where there is data in a dataframe/matrix.
>Is there any r function that can help to easily select data on the
>first and last day of the month from the given set of dates and values.
>Thanks for the help in advance.
>Regards,
>Gaurang
>
>
>This email is intended for the person or company named and access by
>anyone else is unauthorised. If you are not the person or company
>named, please delete this email and notify the sender.
>
>The information in this email, including any attachments, may be
>confidential or legally privileged (meaning that its disclosure is
>protected in law). Its unauthorised disclosure, copying, distribution
>or use is prohibited and may be unlawful.
>
>Email communications sent over the internet are not guaranteed to be
>secure or virus-free and such messages are potentially at risk.  The
>Royal London Group accepts no liability for any claims arising from use
>of the internet to transmit messages by or to any company within the
>Royal London Group.
>
>The Royal London Group consists of The Royal London Mutual Insurance
>Society Limited and its subsidiaries.
>
>The Royal London Mutual Insurance Society Limited is authorised by the
>Prudential Regulation Authority and regulated by the Financial Conduct
>Authority and the Prudential Regulation Authority and provides life
>assurance and pensions.
>
>Registered in England and Wales number 99064.
>
>Registered office: 55 Gracechurch Street, London, EC3V 0RL.
>
>In the Republic of Ireland: The Royal London Mutual Insurance Society
>Limited is authorised by the Prudential Regulation Authority in the UK
>and is regulated by the Central Bank of Ireland for conduct of business
>rules.
>
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to