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

Extract certain number patterns from an integer in a vector

$
0
0

For data Quakes that looks like:

    Date      Latitude   Longitude   M
1 18001011       ...
2 18001122
3 18030000 
4 19001010                        ...

class(Quakes$Date) gives "integer" and without using regular expressions to grab patterns, how do we extract years, months, and days?

For first row with 18001011, it would be:

Year = 1800, Month = 10, Day = 11

Viewing all articles
Browse latest Browse all 205372

Trending Articles



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