8.5 날짜-시간(POSIXct) 변수에서 정보 추출하기
8.5.1 관련 함수
lubridate 패키지는 또한 POSIXct 날짜-시간 변수에서 시간 정보를 추출할 수 있게 해 주는 다음과 같은 함수를 제공한다:
hour()minute()second()
8.5.2 POSIXct 변수에서 정보 추출 예
# break up the time variable decision time
# display as a data.frame with 4 columns
with(dates, ## with() tells R to look for variables in object "dates"
data.frame(time=decision_time, h=hour(decision_time),
m=minute(decision_time), s=second(decision_time)))## time h m s
## 1 2015-10-10 07:15:55 7 15 55
## 2 2011-09-27 14:57:23 14 57 23
## 3 2015-04-24 02:03:03 2 3 3