Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.