Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Extract dates in various formats from string in R

$
0
0

I need to quickly extract dates from character vectors. I have 2 main issues:

  • Various date formats (European and American, alphanumeric and numeric...)
  • Multiple dates in each vector.

My vectors are something as follows:

c("11/09/2016 Invoice Number . Date P.O. # Amount Discount Paid Amount 2017/015 10/28/2016 CC6/ $50,000.00 $0.00 $50,000-00 2017/016 10/28/2016 CC67 $50,000.00 $0.00 $50,000-00 2017-017 10/28/2016 CC67 $50,000.00 . $0.00 $50,000.00 TOTALS: $150,000.00 $0.00 $150,000.00     ")

I have tried using parse_date and strptime without success. I do not know anything about the regex syntax and do not really have time to dig into it.

Warmly thank you for your help.


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>