Created
October 29, 2016 00:45
-
-
Save tengpeng/63b222be183b64ffff5ed7fc1d05c5ab to your computer and use it in GitHub Desktop.
Access date and time components in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as.POSIXlt(as.Date(i)) | |
orders$day <- orders$dd_mmm_yy$mday # day of month | |
orders$month <- orders$dd_mmm_yy$mon+1 # month of year (zero-indexed) | |
orders$year <- orders$dd_mmm_yy$year+1900 # years since 1900 | |
# http://stackoverflow.com/questions/8126537/extract-date-elements-from-posixlt-and-put-into-data-frame-in-r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment