#> I want to create a column that will identify the time of the day (Morning, Afternoon, Evening) based on the variable time.
day_time <- tibble(football)%>%
mutate(time_of_day = if (time >= hms("06:00") & time<= hms("12:00") ){print ("Morning")}
else if (time> hms("12:00") & time<= hms("18:00")){print("Afternoon")}
else {print ("Evening")}
)
day_time
I am getting this error message:
Error: Problem with mutate()
column time_of_day
.
i time_of_day = if (...) NULL
.
x missing value where TRUE/FALSE needed
Run rlang::last_error()
to see where the error occurred.
In addition: Warning messages:
1: Problem with mutate()
column time_of_day
.
i time_of_day = if (...) NULL
.
i Some strings failed to parse, or all strings are NAs
2: Problem with mutate()
column time_of_day
.
i time_of_day = if (...) NULL
.
i Some strings failed to parse, or all strings are NAs
3: Problem with mutate()
column time_of_day
.
i time_of_day = if (...) NULL
.
i the condition has length > 1 and only the first element will be used