@harsh17 Many thanks! How can I achieve breaks in the second scenario, i.e., week_other? That is, rather than showing all the weeks, how can I display, for example, every fourth week?
I feel like you are approaching the problem more complicated than it is. You don't need to wrangle with `week_other'. Here's an approach where I changed the output format of the date on the x axis.
df %>%
ggplot(aes(x = as.Date(week), y = profit)) +
geom_line() +
scale_x_date(date_breaks = "4 weeks", # could be 2 weeks or 1 month or anything
labels = scales::date_format(format = "%Y0%W")) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))