Can tell me why the order is incorrect in my generated table below?. I filtered from 11/07 (Sunday) to 11/13 (Saturday). But as you can see, in the generated table, Saturday is getting by the second and not the last. The rest is OK, only Saturday went wrong.
library(dplyr)
Test <- structure(list(Week = c("Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday","Sunday"),
Category = c("FDE", "FDE", "FDE", "FDE","FDE","FDE","FDE"),
time = c(4, 6, 3, 2,3,3,4)), class = "data.frame",row.names = c(NA, -7L))
wk_port2eng <- data.frame(
WeekE = c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"),
WeekP = c("segunda-feira", "terca-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sabado", "domingo")
)
left_join(Test, wk_port2eng, by = c("Week" = "WeekE")) %>%
arrange(match(WeekP, weekdays(as.Date(c("2021-11-07", "2021-11-13"))))) %>%
select(-WeekP)
Week Category time
1 Sunday FDE 4
2 Saturday FDE 3
3 Monday FDE 4
4 Tuesday FDE 6
5 Wednesday FDE 3
6 Thursday FDE 2
7 Friday FDE 3