I need help fixing the error in this code
# Get day of the week from date to incorporate intra-week trends (model_data <- model_data%% mutate (day=wday (date, abbr = TRUE, label=TRUE), # Get day of the week from date to incorporate intra-week trends month=month(date, abbr = TRUE, label=TRUE), day=as_factor (day), month=as_factor (month))) # Get month from date to incorporate trends over a month Error in 'mutate: Problem while computing day = wday (date, abbr = TRUE, label = TRUE) Caused by error in 'as.Posixīt.default ! do not know how to convert 'x' to class "POSIXTt" Backtrace: 1. model_data%>% ... 8. lubridate:::wday.default(date, abbr = TRUE, label = TRUE) 11. base:: as.POSIXTt.default(x, tz = tz(x)) 12. base :: stop(...) Error in mutatec., day = wday (date, abbr = TRUE, label = TRUE), month = month(date, : Caused by error in 'as.Postxlt.default: do not know how to convert 'x' to class "POSIX1t" t Show Traceback
# Get day of the week from date to incorporate intra-week trends (model_data <- model_data%% mutate (day=wday (date, abb
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
# Get day of the week from date to incorporate intra-week trends (model_data <- model_data%% mutate (day=wday (date, abb
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!