Created
April 25, 2019 05:04
-
-
Save akshat3096/ddb361a53692978477f73ff8604f9a42 to your computer and use it in GitHub Desktop.
This file contains 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
install.packages("lubridate") | |
library(lubridate) | |
#make endDate in a date-time variable POSIXct using lubridate with Indian time zone | |
df$endDate <-ymd_hms(df$endDate,tz="UTC") | |
#new features | |
df$month<-format(df$endDate,"%m") | |
df$year<-format(df$endDate,"%Y") | |
df$date<-format(df$endDate,"%Y-%m-%d") | |
df$dayofweek <-wday(df$endDate, label=TRUE, abbr=FALSE) | |
df$hour <-format(df$endDate,"%H") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment