score:1

Accepted answer

with the help of arrange() and fct_inorder(), i believe i've achieved your desired outcome:

stocks %>%
  arrange(time) %>%
  mutate(
    month = month(time, label = t),
    year  = str_extract(as.character(year(time)), "..$"),
    time2 = fct_inorder(paste(month, year, sep = "'"))
  ) %$%
  hcboxplot(x = stock_price, time2) %>%
  hc_chart(type = "column")

Related Query

More Query from same tag