Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Getting last two digits of Sequence Date in R

I have sequence date:

names<-format(seq.Date(as.Date("2012-11-01"),as.Date("2012-12-01"),
                by = 'months'),format = "%Y%m")

How can I get the last two digit, like the result for last two digits of names[1] is 11?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Using the stringr package you can just put

stringr::str_sub(string = names, start = -2, end = -1)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading