Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(data.table)
- library(lubridate)
- DT <- fread("
- Time, Leave, UniqueBusID, rid, qid
- 2015-01-01 13:36:50.000, False, 屯區藝文中心->莒光新城163, 1, 2
- 2015-01-01 13:36:56.000, True , 屯區藝文中心->莒光新城163, 2, 2
- 2015-01-01 13:37:28.000, False, 屯區藝文中心->莒光新城163, 3, 2
- 2015-01-01 13:37:38.000, False, 屯區藝文中心->莒光新城163, 4, 2
- 2015-01-01 13:38:43.000, False, 屯區藝文中心->莒光新城163, 5, 2
- 2015-01-01 13:37:53.000, True , 莒光新城->屯區藝文中心164, 1, 1
- 2015-01-01 13:38:19.000, False, 莒光新城->屯區藝文中心164, 2, 1
- 2015-01-01 13:38:38.000, False, 莒光新城->屯區藝文中心164, 3, 1
- 2015-01-01 13:38:58.000, False, 莒光新城->屯區藝文中心164, 4, 1
- 2015-01-01 13:39:10.000, False, 莒光新城->屯區藝文中心164, 5, 1 ")
- # method 1
- DT[ , Time := fast_strptime(Time, "%Y-%m-%d %H:%M:%OS", lt = FALSE)]
- # method 2
- DT[ , Time := strptime(Time, "%Y-%m-%d %H:%M:%OS")]
Advertisement
Add Comment
Please, Sign In to add comment